Inventory
VBScript: Batch Audit Service Status Across Multiple Windows Servers

Keeping track of critical services—like SQL, IIS, or Print Spooler—across a large server farm is a common headache for admins. While PowerShell is the modern go-to, many legacy environments and specific automation workflows still rely on the reliability of VBScript and WMI (Windows Management Instrumentation).
This script allows you to pull a full inventory of every service on a list of servers, including their start mode (Automatic/Manual), current state (Running/Stopped), and the Service Account being used.
Prerequisites & Setup
- Create the workspace: Create a folder named
C:\Temp\ServiceDetails. - The Server List: Create a file named
Servers.txtin that folder. List your server names or IP addresses, one per line. - Permissions: You must run this script from an account that has Local Administrator rights on all target servers to query WMI.
The VBScript Solution
Save the code below as ServiceDetails.vbs in your C:\Temp\ServiceDetails folder.
' --- START OF SCRIPT ---ServerList = "C:\Temp\ServiceDetails\Servers.txt"arrServices = Array("") ' Leave empty to get all servicesDim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")Dim objOut : Set objOut = objFSO.CreateTextFile("C:\Temp\ServiceDetails\ServiceQuery.csv")arrComputers = Split(objFSO.OpenTextFile(ServerList).ReadAll, vbNewLine) ' Write CSV HeadersObjOut.WriteLine "SERVER, SERVICE DISPLAY NAME, SERVICE STARTMODE, SERVICE STATUS, SERVICE ACCOUNT"For Each strComputer In arrComputers If Trim(strComputer) <> "" Then strAlive = IsAlive(strComputer) objFound = 0 If strAlive = "Alive" Then On Error Resume Next Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") If Err.Number <> 0 Then ObjOut.WriteLine strComputer & ", WMI ERROR, N/A, N/A, N/A" Err.Clear Else Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service") For Each objItem In colItems ObjOut.WriteLine strComputer & "," & objItem.DisplayName & "," & objItem.StartMode & "," & objItem.State & "," & objItem.StartName objFound = 1 Next End If Else ObjOut.WriteLine strComputer & "- UnResolved, N/A, N/A, N/A, N/A" End If End IfNextobjOut.CloseMsgBox "Service Export Complete!", 64, "LazyAdmin Notification"' Function to Ping the server before attempting WMI connectionFunction IsAlive(strComputer) Set WshShell = WScript.CreateObject("WScript.Shell") Set objExecObject = WshShell.Exec("%comspec% /c ping -n 1 -w 500 " & strComputer) strText = objExecObject.StdOut.ReadAll() If Instr(strText, "Reply from") > 0 Then IsAlive = "Alive" Else IsAlive = "Dead" End If End Function
How it Works
- WMI (Win32_Service): The script connects to the
root\CIMV2namespace on the remote machine to query theWin32_Serviceclass. This is the same data you see inservices.msc. - The Ping Check: Before trying to connect (which can be slow if a server is down), the
IsAlivefunction pings the host. This significantly speeds up the script if you have offline servers in your list. - CSV Output: All data is appended to a
.csvfile, making it ready for a pivot table in Excel to find services running under old service accounts or identifying disabled critical services.
#SysAdmin #WindowsServer #VBScript #WMI #ITAutomation #ServerManagement #TechTips #LazyAdmin #Infrastructure #ITAudit
Batch Script: Query Disk Space Across Multiple Servers using PsInfo

Managing disk space across a sprawling server environment is a constant challenge. While modern monitoring tools exist, sometimes you just need a quick, lightweight way to pull drive statistics from a specific list of servers without setting up complex infrastructure.
This “Lazy Admin” solution uses the classic PsInfo utility from the Microsoft Sysinternals suite to sweep your network and compile disk data into a single CSV.
Prerequisites
Before running the script, ensure you have the following in a single folder:
- PsInfo.exe: Download this as part of the PSTools suite from Microsoft.
- Servers.txt: A simple text file containing the names or IP addresses of your target servers (one per line).
- Admin Rights: You must execute the script with a domain account that has local administrative privileges on the remote servers.
The DiskSpace.cmd Script
Copy the code below and save it as DiskSpace.cmd in your PSTools folder.
@Echo OffSetLocal EnableDelayedExpansion:: Delete existing report if it existsIF EXIST Free_Disk_Space_Servers.csv DEL Free_Disk_Space_Servers.csv:: Loop through the Servers.txt fileFOR /F "Tokens=*" %%L IN (Servers.txt) DO ( SET ServerName=%%L Echo Processing !ServerName!... :: Run PsInfo against the remote server and append output to CSV :: The -d switch pulls disk volume information Psinfo -d /accepteula \\!ServerName! >> Free_Disk_Space_Servers.csv)Echo Export Complete: Free_Disk_Space_Servers.csvPause
How it Works
Psinfo -d: The-dflag tells the utility to display volume information, including drive letters, total size, and free space.SetLocal EnableDelayedExpansion: This allows the script to update theServerNamevariable dynamically as it loops through your text file.>> Free_Disk_Space_Servers.csv: This appends the output of every server query into one continuous file./accepteula: Added to the command to ensure the script doesn’t hang waiting for you to click “Accept” on the Sysinternals license agreement for every server.
💡 Lazy Admin Tip
The output from PsInfo is a bit “chatty” for a standard CSV. Once you open it in Excel, use the Data > Text to Columns feature or simple Find/Replace to clean up the headers. If you need a more modern, native approach, consider using a PowerShell one-liner like: Get-WmiObject Win32_LogicalDisk -ComputerName (Get-Content Servers.txt) | Select-Object SystemName, DeviceID, FreeSpace
#SysAdmin #WindowsServer #Sysinternals #PSTools #BatchScript #ITPro #DiskManagement #LazyAdmin #ServerAudit #TechTips
How to Get Hardware Serial Numbers Remotely (WMIC & PowerShell)

As a SysAdmin, you often need a serial number or UUID for a warranty check or asset tracking. Instead of walking to the user’s desk or remoting into their session, you can pull this data directly from your workstation using these simple commands.
1. Using WMIC (Legacy Command Line)
WMIC is incredibly efficient for quick, one-off queries against remote systems.
To get a remote serial number:
DOS
wmic /node:"RemoteComputerName" bios get serialnumber
To export results to a central text file: If you are auditing multiple machines, use the /append switch to create a running list:
DOS
set myfile=\\Server\Share\Inventory.txtwmic /append:%myfile% /node:"RemoteComputerName" bios get serialnumber
2. Using PowerShell (Modern Method)
PowerShell is the preferred method for modern Windows environments (Windows 10/11 and Server 2016+). It returns objects that are much easier to manipulate.
Standard Command:
PowerShell
Get-WmiObject -ComputerName "RemoteComputerName" -Class Win32_BIOS
The “Lazy” Short Version:
PowerShell
gwmi -comp "RemoteComputerName" -cl win32_bios
3. Bonus Hardware Commands
Sometimes the serial number isn’t enough. Use these WMIC commands to get a deeper look at the hardware specs:
- CPU Details: Get the exact model and clock speeds.
wmic cpu get name, CurrentClockSpeed, MaxClockSpeed - System Product Info: Pull the motherboard name and the system’s unique UUID.
wmic csproduct get name, identifyingnumber, uuid - Full BIOS Audit: Get the BIOS name, version, and serial number in one go.
wmic bios get name, serialnumber, version
Troubleshooting Connectivity
If these commands fail with “Access Denied” or “RPC Server Unavailable,” check the following:
- Admin Rights: Your shell must be running with Domain Admin or local administrator permissions on the target.
- Firewall: Ensure “Windows Management Instrumentation (WMI)” is allowed through the Windows Firewall on the remote machine.
- WMI Service: Ensure the WinMgmt service is running on the target.
#SysAdmin #PowerShell #WMIC #WindowsServer #ITPro #TechTips #InventoryManagement #LazyAdmin #RemoteAdmin #HardwareHack