I just love using Bat programs and want to share some of my work with you all.
1. ServiceTag
If you have a large number of computers that you cant access the servicetag on, this bat program will do the trick:
If you want it to export to an server just replace "C:\SERVRAR.txt" with "\\Server01\folder1\server.txt"
:: Output
:: *********************************
:: Server: SERVER1
:: IP: 192.168.1.1
:: Serial: ABCDEFGH
:: Model: Latitude D610
:: *********************************
@echo off
:: Retrive Computername
set dator=%computername%
:: Get's ip address
IPCONFIG |FIND "IPv4" > %temp%\TEMPIP.txt
FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a
del %temp%\TEMPIP.txt
set ip=%IP:~1%
:: Get the SerialNumber/ServiceTag
for /F "skip=2 tokens=2 delims=," %%A in ('wmic bios get serialnumber /FORMAT:csv') do (set "nyckel=%%A")
:: Gets the ModellName
for /F "skip=2 tokens=2 delims=," %%A in ('wmic csproduct get name /FORMAT:csv') do (set "mnamn=%%A")
echo ********************************* >> C:\SERVRAR.txt
echo Server: %dator% >> C:\SERVRAR.txt
echo IP: %ip% >> C:\SERVRAR.txt
echo Serial: %nyckel% >> C:\SERVRAR.txt
echo Model: %mnamn% >> C:\SERVRAR.txt
echo ********************************* >> C:\SERVRAR.txt
echo. >> C:\SERVRAR.txt
2. Change IP-Address
When I was more of an server-tech guy I always had to change my ip for different reasons and got tiered of doin it manually and did a bat program with a multi choise.
@echo off
:menu
cls
echo 1 Choose IP-Address
echo 2 Choose IP-Address and Netmask
echo 3 DHCP
echo 4 Quit
echo.
set choice=
set /p choice="(1-4):"
if '%choice%'=='' goto menu
if '%choice%'=='1' goto ange
if '%choice%'=='2' goto angeb
if '%choice%'=='3' goto dhcp
if '%choice%'=='4' goto end
goto menu
:ange
echo Choose IP-Adress:
set /p IP=
netsh interface ipv4 set address name="Local Area Connection" static %IP% 255.255.255.0
pause
goto end
:angeb
echo Choose IP-Adress and netmask:
set /p IP=
netsh interface ipv4 set address name="Local Area Connection" static %IP%
pause
goto end
:dhcp
netsh interface ipv4 set address name="Local Area Connection" source=dhcp
pause
goto end
:end
Hope this help some people
