Get a list of Windows Services, Scheduled Tasks and Application Pools where a specific user account is used, or Windows Services, Scheduled Tasks and Application Pools being run by NON system accounts.

4.6 Star
7,838 times
Add to favorites
Operating System
E-mail Twitter Digg Facebook
  • A note on a 2016 hypervisor
    1 Posts | Last post June 27, 2019
    • Great script up to our 2012R2 machines.
      On our 2016 host, the following occured:
      ERROR: The task XML contains a value which is incorrectly formatted or out of range.
  • only message i get is cannot connect
    1 Posts | Last post June 13, 2019
    • heres what i'm running. 
      PS C:\> ..\get-serviceaccountusage.ps1
      PS C:\> $arrComputersList= Get-Content c:\temp\computers11.txt
      PS C:\> $arrComputersList | Get-ServiceAccountUsage -UserAccount 'nc\svc-scom'
      WARNING: Cannot connect to
      WARNING: Cannot connect to
      theres around 20 machines in my computers11.txt and i'm just not getting anything for them no warning or anything. even when i remove the -quite i'm still only getting errors for the ones that it can't connect to. 
      does this script save the info to a differant location or something?
  • Hi Martin, exist a parameter for selected all computer of the domain, without fill file with the names of the computers?
    1 Posts | Last post April 27, 2019
  • Where do I store "ComputerList"?
    4 Posts | Last post February 18, 2019
    • Where do I store the ComputerList in order to use the following function:
      $arrComputersList | Get-ServiceAccountUsage -UserAccount 'myDomain\myServiceAccount'
    • Even i am stuck here 
      Where do I store the ComputerList in order to use the following function 
      Any Idea??
    • $arrComputersList= Get-Content C:\servers.txt
      $arrComputersList | Get-ServiceAccountUsage -UserAccount 'myUserAccount'
    • Please see my answer to @Chicojrman123 
  • Not getting this script
    2 Posts | Last post February 18, 2019
    • I stored all my computers to run one service account against and it fails:
      $arrComputersList= Get-Content C:\servers.txt
      $arrComputersList | Get-ServiceAccountUsage -UserAccount 'etladmd'
      Here is my error: Get-ServiceAccountUsage : The term 'Get-ServiceAccountUsage' is not recognized as the name of a cmdlet, function, script file, or 
      operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    • You need to "dot source" the script, to import the function into your session.
      PS C:\> cd C:\scripts
      PS C:\scripts> . .\Get-ServiceAccountUsage.ps1
      PS C:\scripts> $arrComputersList= Get-Content C:\servers.txt
      PS C:\scripts> $arrComputersList | Get-ServiceAccountUsage -UserAccount 'myUserAccount'
  • no output for iis 8.5
    3 Posts | Last post February 18, 2019
    • This is one of the coolest most useful scripts I've used in a long time. Thanks a million. 
      I am getting output for everything but iis 8.5. I read your comments about support for everything above iis 7, but I am testing this and nothing. Is there a way we can update the script?
    • strange. it works for some for not all. 
    • @Nadie166, 
      The script uses WMI to connect to the remote servers. 
      Maybe the WMI repository is corrupted on the servers it fails to query, or the namespace or classes are missing. 
      Try it yourself, using wbemtest.exe to query the root\WebAdministration namespace (and the ApplicationPool class)
  • No output
    2 Posts | Last post July 06, 2018
    • im running the below, but i dont seem to get any output at all 
      (Get-AdComputer –Filter * –SearchBase “DC=contoso,DC=com”).name | C:\support\GET-ServiceAccountAudit\Get-ServiceAccountUsage –UserAccount ‘contoso\Administrator’
      as below i would like to run it against all domain computers .. i don't receive any errors , simply nothing is output.. could you help me ?. 
    • Did you "dot source" the script before?
      Try this:
      PS C:\> cd C:\support\GET-ServiceAccountAudit
      PS C:\support\GET-ServiceAccountAudit> . .\Get-ServiceAccountUsage.ps1
      PS C:\support\GET-ServiceAccountAudit> (Get-AdComputer –Filter * –SearchBase 'DC=contoso,DC=com').name | Get-ServiceAccountUsage –UserAccount 'contoso\Administrator'
  • script execution issues
    1 Posts | Last post April 18, 2018
    • while running the script I get no output. No errors. I tried all the tasks decribed in the description, also set the execution policy to unrestricted. All run from both Windows 10 and Win2012R2.
      Please advise
  • Server 2012 R2...
    2 Posts | Last post October 14, 2015
    • How would I add IIS versions higher than 7? for example, 2012 R2 IIS 8.5?
    • You don't need to do anything special. IIS 7 and above (up to 8.5 and soon 10) use the same WebAdministration namespace. 
  • How do i run this Script
    1 Posts | Last post January 06, 2015
    • I have tried to run your script but i can't seem to run it. i've tried 
      PS> CD C:\myScripts
      PS C:\myScripts> . .\Get-ServiceAccountUsage.ps1
      PS C:\myScripts> Get-ServiceAccountUsage -UserAccount 'myDomain\myUser'
      i keep getting an error Get-ServiceAccountUsage.ps1 is not recognized as the name of a cmdlet
      Any help would be greatly appreciated. 
1 - 10 of 14 Items