Created
November 18, 2017 19:52
-
-
Save bordplate/ce64d2c1474801cc6a987a021d497bc9 to your computer and use it in GitHub Desktop.
Script to enumerate services on a Windows system and list their permissions. Writes to a file in folder called services.txt. Run with `cscript service-permissions-enumeration.vbs`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") | |
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service ") | |
Set objShell = CreateObject("Wscript.Shell") | |
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
For Each objService in colListOfServices | |
Dim path, x | |
path = objService.PathName | |
x = Instr(path,"-") | |
If x Then path = Left(path,x-1) | |
x = Instr(path,"/") | |
If x Then path = Left(path,x-1) | |
path = Trim(path) | |
wscript.echo path | |
objShell.Run "cmd /c icacls """ & objService.PathName & """ >> services.txt", 0, True | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment