I’m running Powershell in both Windows 2003 and Windows 2008 and both are running 2.0 but in Windows 2003 wildcards don’t seem to be accepted (or at least don’t react in the same way). For example:
((get-counter -counter '\process(w3*)\id process').CounterSamples)
works fine in Windows 2008 but failed in Windows 2003.
((get-counter -counter '\process(w3wp)\id process').CounterSamples)
works fine in Windows 2003.
How can I filter based on wildcards in Windows 2003?
Hi I had a problem like this and it seemed to be caused by the differences between how windows server 2003 and 2008 work not powershell its self ,so what i did was to write a code block that detected what version of windows server I was running and then change the code I was going to execute. You can use the code below or put it in switch statement.