How to find if service account is running on server or from workstation
i need know if using service account local machine or on server
in local services accounts not in use tested powershell script
my target find users using service accounts
#get-adprincipalgroupmembership srv-vmw-esx-501 | select name#edit below variable input name of account want find services logging on as
$account="srv-abc-123"
#—————————————————–#
#imports active directory powershell module
import-module activedirectory
# gets servers in domain
$servers=get-adcomputer -filter {operatingsystem -like "windows *server*"} -property *
# each server, find services running under user specified in $account
foreach ($server in $servers){
$services=get-wmiobject win32_service | where-object {$_.startname -like "*$account*"}
# list services running $account in powershell console
# if there no services running under $account, output console.
if($services -ne $null){
write-host $services
}
elseif ($services -eq $null){
write-host "no services found running under $account on server $server"
}
}
#—————————————————–#
#end
i wait hear guys.
thanks
asim
asim khan
you can usesimilar below query list of services , instances running in on computer in particular ou
for /f "tokens=1" %1 in ('dsquery computer
@wmic /node:%1 /failfast:on service (startname!="localsystem"
, startname!="nt authority\\localservice" and
startname!="nt authority\\networkservice")
caption,startname > c:\temp\svc-list-%1.txt
Windows Server > Directory Services
Comments
Post a Comment