Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230663

problem displaying results with a duplicate mac script

$
0
0

I'm still fairly new to powershell scripting, and have learned quite a bit from reading the code others have put together here on the forum and other blogs. Given that, i still have a lot to learn and i'm having a really frustrating issue with a small script i was asked to put together.

 

The purpose of the script is to try to locate duplicate MAC addresses seperately for VM's, Host physical Nics, and VMKernal interfaces. So it first gathers all of the MAC addresses for each and stores them individually. It also combines each of them into an array, so that this way it can list duplicates they each have individually, as well as duplicates between them as well. When i run the ps1 file in powercli, i get partial results. The VMKernel area lists the mac address, but not the related host or portgroup name. The combined results end up completely empty. If i paste the exact contents of the ps1 file into powercli directly, it runs through correctly and displays all required information that is not there when i run the script file, except for the vmkernal host and portgroup name again. For some reason that one won't display all the information at all. I noticed that the amount of extra blank lines being displayed in the combined area are the same amount of lines of the results that come through when i just paste the script in. So its like it knows there is data, but just can't visually display it for some reason and i honestly don't know enough to figure out why. I assume its some kind of formatting issue, and i'm hoping someone can tell me what i'm doing wrong.

 

Attached is a copy of the script, as well as copy/paste's of the powercli window from running the script, and also just pasting the script into the window. Obviously though, my poor coding style makes it semi difficult to read where i just pasted the script contents into powercli.

 

Note: As per the vmworld session i attended with LucD as one of the hosts, i apoligize for killing puppies with my continuous use of write-host   I haven't had time to look into the alternatives, and get myself used them as much yet.

 

I really appreciate any help that anyone can provide me

 



Viewing all articles
Browse latest Browse all 230663

Trending Articles