Back to Blog
Arnošt Havelka

Practical: System Audit

Scripting a professional system inventory report.

Start Interactive Lesson
Practical: System Audit

Practical: System Audit Script

As a Sysadmin, your boss wants a report on a workstation's status. Instead of running commandsmanually, let's write a batch script to generate a professional report automatically.

The Mission

Create audit.bat that:

  1. Grabs the Hostname.
  2. Grabs the IP Address.
  3. Grabs the Running Processes.
  4. Saves it all to report.txt.

Step 1: The Script Structure

We will use echo to create headers and redirection >> to compile the file.

Command Prompt
C:\Users\User>copy con audit.bat

Step 2: Running the Audit

Execute the script.

Command Prompt
C:\Users\User>audit.bat

Step 3: Viewing the Report

Let's see what we generated.

Command Prompt
C:\Users\User>type report.txt

Knowledge Check

1 / 2

Why do we use '>>' instead of '>' for the second command?

References

These Microsoft Learn and Windows documentation links provide authoritative details for the commands used in this article.

Up Next

Process Mgmt

View and kill running tasks with tasklist and taskkill.