This project has moved. For the latest updates, please go here.


PowerShell Error when using PSv1 on Server2003R2


When running the standard powershell script for a WMI Class, the following error is generated on Server 2003 R2 (PowerShell v1).

Missing expression after unary operator '-'.
At line:1 char:2
  • -E <<<< xecutionPolicy Bypass -NoLogo -NoExit C:\DOCUME~1\uname\LOCALS~1\Temp\1\temp_script.ps1
Closed Oct 25, 2014 at 11:16 PM by vinpa


vinpa wrote Oct 25, 2014 at 12:17 AM

This error occurs because PowerShell v1 does not have the -ExecutionPolicy switch which WMI Explorer uses to Bypass the current execution policy. You would need to either use PowerShell v2 or run the script via PowerShell instead of WMI Explorer.

wrote Oct 25, 2014 at 11:16 PM