could you please advise how to find all servers where a specific service account is being used to start windows services?
I am trying this in Powershell with these code:
Clear-Host
$address = Get-Content '.\asg connections.csv'
$serviceName = "startname='NT AUTHORITY\\LocalService'"
gwmi win32_service -filter $serviceName -computer $address
above piece of code works for "localhost", but gives below error for the remote hosts
gwmi : Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))
At F:\Temp\powershell\play.ps1:30 char:1
+ gwmi win32_service -filter $serviceName -computer $address
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedA
ccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow
erShell.Commands.GetWmiObjectCommand
screenshot 's attached gwmi: Access is denied Thank you.
Yermek
User contributions licensed under CC BY-SA 3.0