Services Log On As search

%3CLINGO-SUB%20id%3D%22lingo-sub-1427079%22%20slang%3D%22en-US%22%3EServices%20Log%20On%20As%20search%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1427079%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20craft%20a%20PS%20script%20that%20will%20search%20designated%20domain%20joined%20servers%20for%20running%20services%20that%20are%20designated%20with%20a%20specific%20'Log%20on%20As'%20account%20and%20list%20them%20by%20server%20and%20service.%20I%20am%20completely%20lost%20on%20this.%20Can%20anyone%20make%20some%20suggestions%20or%20point%20me%20in%20the%20right%20direction%20on%20this%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1427079%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1464212%22%20slang%3D%22en-US%22%3ERe%3A%20Services%20Log%20On%20As%20search%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1464212%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F683690%22%20target%3D%22_blank%22%3E%40McSnert%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20get%20this%20info%20from%26nbsp%3B%3CSTRONG%3Ewin32_service%20%3C%2FSTRONG%3Eobject.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EGet-CimInstance%20win32_service%20%7C%20select%20name%2Cstartname%2Cstartmode%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReference%3A%20%3CA%20href%3D%22https%3A%2F%2Fdevblogs.microsoft.com%2Fscripting%2Fthe-scripting-wife-uses-powershell-to-find-service-accounts%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EPowerShell%20to%20Find%20Service%20Accounts%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20that%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I am trying to craft a PS script that will search designated domain joined servers for running services that are designated with a specific 'Log on As' account and list them by server and service. I am completely lost on this. Can anyone make some suggestions or point me in the right direction on this?

Thanks.

1 Reply

Hello @McSnert,

 

You can get this info from win32_service object.

Get-CimInstance win32_service | select name,startname,startmode

 

Reference: PowerShell to Find Service Accounts 

 

Hope that helps.