Introduction: Wmic Powershell Script to Get Computer Information Using 'wmic' Command (Serial Number, Manufacturer, Model, Network Printers)
In this article. The Win32PrinterDriver WMI class represents the drivers for a Win32Printer instance. The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties, but excludes methods. The program itself should use a methods such as WMI and PJL/PCL/PML to extract as much of the following information as possible from USB connected printers (we understand that not all devices will return all of the desired information): Manufacturer Model Name/Number Serial Number Total Pages Printed Total Mono Pages Printed.
# Using wmic command to get information about computer and write to file
# To use: Right click on File name > Left click on 'Run in Powershell'
# Or hit F5 from within Powershell ISE editor
# Create a file on the C drive
out-file c:tempcomputerinfofile.txt
# Get the serial number and overwrite text file if it exists already
wmic bios get serialnumber > c:tempcomputerinfofile.txt
# Get the manufacturer and add it to the end of the text file
wmic computersystem get manufacturer >> c:tempcomputerinfofile.txt
# Get the model of the computer and add it to the end of the text file
wmic computersystem get model >> c:tempcomputerinfofile.txt
# Get the printers that are connected to the computer and add to the end of the text file
wmic printer get name >> c:tempcomputerinfofile.txt
write-output '-------------------'
write-output '-------------------'
write-output 'Please open the text file on your I drive now to check data.'
write-output 'Written by Matt R'
Be the First to Share
Recommendations
Wmi Printer Serial Number Identification
Make it Glow Contest
First Time Author Contest
PCB Challenge