VarjuOrg

Linux / Windows – what’s the difference…

Kuidas lihtsalt küsida kasutajalt tema arvuti andmeid…

Töötades Service Deskis, tekkis suht kiiresti tahtmine loobuda kysida kasutajatelt nende arvuti tunnuseid, kuna tihtipeale kas ei suutnud nad nei d yles leida või ei saanud kysimusest aru.

Nii tuligi idee luua pisike koodijupp, mida oleks lihtne ka kasutajatele saata ja pärast nendekäest vastusfailid tagasi kysida…

Kood:

@echo off
TITLE Where am I
rem This batch file displays the machine name and domain of the current user and puts IPCONFIG /all to desktop
rem Kristjan T 2009
cls
echo.
echo ----------------------------------
echo You are logged in as...
set username
echo ----------------------------------
echo Your PC's name is...
set computername
echo ----------------------------------
echo You are connected to the domain...
set userdomain
echo ----------------------------------
echo Your IP address is...
ipconfig |find "IP Address"
echo ----------------------------------
echo.
echo Sending ipconfig /all to desktop as:
echo %username%_%computername%_ipconfig-all.txt 
ipconfig /all > c:docume~1%username%Desktop%username%_%computername%_ipconfig-all.txt
echo ----------------------------------
echo.
echo.
echo Press any key to close this window
pause >nul
echo.

Kasutamiseks loo desktopile uus txtfail, kleebi kood sinna ning: File > Save as > whoami.bat

Käivitamisel näitab eelmainitud kood: Kasutajanime, arvutinime, domeeni (kui arvuti on domeenis) ning salvestab arvuti IP confi desktopile kujul kasutajanimi_arvutinimi_ipconfig-all.txt

Edukat testimist.

Leave a Reply

Your email address will not be published. Required fields are marked *