motioneye
asked on
error with my powershell scripts
Hi,
Someone in EE has sharing me on this scripts use to extract accounts services. but it return me below error.
PS F:\PowerShell_Myscripts> .\checkservices.ps1
Missing expression after unary operator '-'.
At F:\PowerShell_Myscripts\ch eckservice s.ps1:5 char:10
+ - <<<< namespace root\Microsoft\SqlServer\C omputerMan agement
PS F:\PowerShell_Myscripts>
Someone in EE has sharing me on this scripts use to extract accounts services. but it return me below error.
PS F:\PowerShell_Myscripts> .\checkservices.ps1
Missing expression after unary operator '-'.
At F:\PowerShell_Myscripts\ch
+ - <<<< namespace root\Microsoft\SqlServer\C
PS F:\PowerShell_Myscripts>
$Instances = get-content "F:\PowerShell_Myscripts\AllServers.txt"
$Instances|%{
$sqlservice = Get-WmiObject
-namespace root\Microsoft\SqlServer\ComputerManagement
-class SqlService
-filter "ServiceName='MSSQL`$_'"
$sqlService
} >> F:\PowerShell_Myscripts\result.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.