How is everyone here posting code so it looks like it came right out of PowerGUI??
When I post code it just looks like text.
Thanks
Boston Tech Guy
Take a look at LucD's document at Some ways to enter PowerCLI code under the new forum SW
André
Mind, when it is only a couple of lines of code, I use the Advanced Editor - Insert - Quote option as well
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Cool! Lets see
THIS IS MY CODE.
LOOK IT WORKED
AND
Connect-VIServer "myvcenter"
$byebye = (Get-Content "C:\Scripts\Delete\bye.txt")
Foreach ($vm in $byebye)
{
IF ($vm.PowerState -eq "PoweredOn")
{
Stop-VM -VM $vm -Confirm:$false
}
ELSE
{
Write-Output $vm "IS OFF"
}
}
Disconnect-VIServer -Confirm:$false
Too bad you have to enter the "<br />" code at the end of lines.
So who gets the points for Answering this question: Andre for replying to the post or LucD for creating the Document :smileylaugh:
Thanks
Boston Tech Guy
Don't worry about the points and rather use the information to help other users with posting helpful code.
If you want to award points anyway, it's Luc who deserves them. I just pointed you to his documentation.
André