Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Script Error

$
0
0

When I am Running this script I am getting this error

If((get-service -name browser -computername User-PC).status -notlike 'running'){ invoke-command -computername User-pc start-service -name browser }

Can Any one explain me whats wrong in it ? 

PS C:\> if ((Get-Service -Name vss -ComputerName user-pc).Status -notlike 'running' {Invoke-Command -ComputerName user-pc
 start-service -name vss}
At line:1 char:77
+ if ((Get-Service -Name vss -ComputerName user-pc).Status -notlike 'running' {Inv ...
+                                                                             ~
Unexpected token '{' in expression or statement.
At line:1 char:77
+ if ((Get-Service -Name vss -ComputerName user-pc).Status -notlike 'running' {Inv ...
+                                                                             ~
Missing closing ')' after expression in 'if' statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken


http://www.arabitpro.com


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>