List all services that uses a service account
Top  Previous  Next


This script scans five machines for services that uses a service account. The result is written to the file "c:\ntreport\ServiceAccounts.txt".

[Settings_Begin]
FileType=NTreport
NTinfo.Name.All.Rows=Yes
NTinfo.Show.Scan=Yes
NTinfo.Services=Yes
NTreport.Delimiter=,
[Settings_End]

[Machines_Begin]
\\EDU12
\\EDU13
\\EDU14
\\EDU15
\\EDU16
[Machines_End]

[Batch_Begin]
Clear.Window Main
Get.Data *LIST*
Filter %COL4% <> and %COL4% <> LocalSystem
If Filter
Write.File c:\ntreport\ServiceAccounts.txt ; Filter ; %col1% %col3% %col4%
DOS net send administrator "NTreport found %filterrows% entries."
Endif
[Batch_End]

How it works

·The "Get.Data" command lists all running services on all [machines] in the main window.  
·The "Filter" command searches for services where column 4 is NOT empty ("") AND NOT "LocalSystem". All matching rows are written to the filter window.  
·The code inside the "If Filter" / "Endif" structure (which writes the result to a file) is executed if the filter windows is not empty.