Hi Guys,
Hopefully another quickone I have the following script
get-vm | Where { $_ | Get-CDDrive | Where { $_.ConnectionState.Connected -eq "true" } } | select @{ Name="Guests"; Expression={$_.name}} | select Guests
When I run this in the PowerCLI I get the following
Guests
-
CW-DemoVC
Demo-Web
Now if I modify the script to look like this
get-vm | Where { $_ | Get-CDDrive | Where { $_.ConnectionState.Connected -eq "true" } } | select @{ Name="Guests"; Expression={$_.name}} | select Guests | convertto-html -head $head -body $header -title $title | out-file -Append c:\test.html
I get this
* |
---|
CW-DemoVC |
Demo-Web |
Why do I get the * in my HTML file and how do I change it to something more meaning full
Cheers
www.virtualisedreality.com | www.twitter.com/virtualisedreal
Sorry to but in, I know you are probably looking into this Luc but I have had this before, its because the convertto-html cmdlet doesnt know the name of objects with a single property, if you changed it to this it would work fine... get-vm | Where { $_ | Get-CDDrive | Where { $_.ConnectionState.Connected -eq "true" } } | select Name, Host | convertto-html -head $head -body $header -title $title | out-file -Append c:\test.html
I recently discussed this on the get-scripting podcast as a "feature" !
If you found this information useful, please consider awarding points for Correct or Helpful.
Alan Renouf
What's in the $head, $header and $title variables ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
These are completed earlier in the script, this is part of a larger post project completition script im attempting to write :smileylaugh:
www.virtualisedreality.com | www.twitter.com/virtualisedreal
Sorry to but in, I know you are probably looking into this Luc but I have had this before, its because the convertto-html cmdlet doesnt know the name of objects with a single property, if you changed it to this it would work fine... get-vm | Where { $_ | Get-CDDrive | Where { $_.ConnectionState.Connected -eq "true" } } | select Name, Host | convertto-html -head $head -body $header -title $title | out-file -Append c:\test.html
I recently discussed this on the get-scripting podcast as a "feature" !
If you found this information useful, please consider awarding points for Correct or Helpful.
Alan Renouf
Cheers guys looks likes like I owe you two a beer!
www.virtualisedreality.com | www.twitter.com/virtualisedreal
No problem Alan, I was in a meeting (yes we do have those as well).
Thanks for the informing us of that "feature".
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference