Link to home
Start Free TrialLog in
Avatar of xmouser
xmouserFlag for United States of America

asked on

Powershell error

I keep getting this error:

PowerCLI C:\> "test.ps1" -AfterDate 08/21/2012 -FileName C:\Report.txt
You must provide a value expression on the right-hand side of the '-' operator.
At line:1 char:13
+ "test.ps1" - <<<< AfterDate 08/21/2012 -FileName C:\Report.txt
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordEx
   ception
    + FullyQualifiedErrorId : ExpectedValueExpression

I've changed the date several times. I'm assuming this is realated to the format of the date but I can't seem to get it to work.
Avatar of dicconb
dicconb
Flag of United Kingdom of Great Britain and Northern Ireland image

Try taking the quotes out from around script filename.

Cheers,

D
Avatar of xmouser

ASKER

That's how I started:

Suggestion [3,General]: The command test.ps1 was not found, but does exist in th
e current location. Windows PowerShell doesn't load commands from the current lo
cation by default. If you trust this command, instead type ".\test.ps1". See "ge
t-help about_Command_Precedence" for more details.

That's why I put the quotes around it.

Also tried it with ".\test.ps1"
Avatar of Steven Carnahan
If I read (and count) it correctly it has to do with the "/" in the date.
Avatar of xmouser

ASKER

The script as posted at MS has it in the format that I'm using. There the example was 09/09/09. How should it be?
ASKER CERTIFIED SOLUTION
Avatar of dicconb
dicconb
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xmouser

ASKER

I'm getting this:


PowerCLI C:\> & ".\test.ps1" -AfterDate 08/21/2012 -FileName C:\Report.txt
Missing closing ')' in expression.
At C:\test.ps1:40 char:12
+             <<<< [String]
    + CategoryInfo          : ParserError: (CloseParenToken:TokenId) [], Parse
   Exception
    + FullyQualifiedErrorId : MissingEndParenthesisInExpression
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points,

D