@echo off
cls
for /f "tokens=2 delims==" %%F in ('wmic csproduct get vendor /format:value') do set vendor=%%F
set vendor=%vendor:,=%
for /f "tokens=2 delims==" %%F in ('wmic csproduct get Name /format:value') do set model=%%F
set model=%model:,=%
for /f "tokens=2 delims==" %%F in ('wmic csproduct get IdentifyingNumber /format:value') do set serial=%%F
for /f "tokens=2 delims== usebackq" %%F in (`wmic os get version /format:value`) do set osver=%%F
for /f "tokens=2 delims== usebackq" %%F in (`wmic nicconfig where "description like '%%ethernet%%'" get DHCPEnabled /format:value`) do set dhcpether=%%F
if %dhcpether% == TRUE (
set ipaddress=DHCP
) else (
for /f "tokens=2 delims== usebackq" %%F in (`wmic nicconfig where "description like '%%ethernet%%'" get IPAddress /format:value`) do set ipaddress=%%F
)
for /f "tokens=2 delims== usebackq" %%F in (`wmic nicconfig where "description like '%%ethernet%%'" get dnsdomain /format:value`) do set etherdomain=%%F
for /f "tokens=2 delims== usebackq" %%F in (`wmic nicconfig where "description like '%%wireless%%'" get dnsdomain /format:value`) do set wifidomain=%%F
for /f "tokens=*" %%F in ('whoami /UPN') do set email=%%F
echo %serial%,%computername%,%username%,%email%,%vendor%,%model%,%ipaddress%,%etherdomain%,%wifidomain%,%osver% >> \\servername\sharename\pc-inventory.csv
cls
echo Hostname=%computername%
echo Script completed successfully.
pause
Friday, September 7, 2018
Get the serial number, computer name, user name, email address, vendor, model, IP address, domain suffix, and OS version from the command line.
I developed this script to do a PC inventory and save it to a network share:
Subscribe to:
Posts (Atom)