Just a little tidbit here. Not anything new by any means. Please don't judge my use of wmic.exe instead of using straight PowerShell until I get a chance to explain it. I've been using wmic.exe for a long time from PowerShell and recently (hard to believe it took this long) ran into this error:
>wmic /node:PC-Name os get name >Invalid Global Switch. >echo %errorlevel% >44125
What I didn't realize is that the computer name needs to be enclosed in double quotes because it contains a hypen:
>wmic /node:"PC-Name" os get name
I'm going to write another post soon explaining why I still use wmic and not a 1 liner in PowerShell to get the same data. For example:
Get-WmiObject -ComputerName PC-Name win32_operatingsystem | select -property Name
Using wmic.exe from PowerShell! It is a little crazy, however extremely effective. Stay tuned ...
If you like this site, help us out.
Spread the word and share it with others!