Reputation: 101
I m looking for a powershell one line script to find all the services that contain the word "Altiris" and service start name not equal 'localSystem'. Is the below a valid script for that purpose?
$Services = get-WMIObject -query "Select * from win32_service where name -contain 'Altiris' and startname -ne 'LocalSystem'"
Upvotes: 2
Views: 3758
Reputation: 25820
There is no -Contains
in WMI Query Language. The operators you are using are all PowerShell operators and the WQL operators are different.
Get-WmiObject -Query "Select * from Win32_Service WHERE Name LIKE '%Altris%' AND StartName
<> 'Localsystem'"
For more information on WQL Operators, read http://msdn.microsoft.com/en-us/library/windows/desktop/aa394605(v=vs.85).aspx
Upvotes: 3