Skip to content

Instantly share code, notes, and snippets.

@Nevexo
Last active June 25, 2017 00:12
Show Gist options
  • Save Nevexo/682cbb4ec3497dee7313b49a5ee893d2 to your computer and use it in GitHub Desktop.
Save Nevexo/682cbb4ec3497dee7313b49a5ee893d2 to your computer and use it in GitHub Desktop.
A batch file to help you debug an Active Directory system with a client having issues. Set the location of results and the raw results location to somewhere both admins and the users that will be making reports can access.
@echo off
set resultsLocation=S:\Support\GroupPolicy\reports\
set rawResults=S:\Support\GroupPolicy\reports\raw\
echo ____________ __ ____
echo _____/ ____/ ___/ ^|/ // _/
echo / ___/ __/ \__ \^| / / /
echo / / / /___ ___/ / ^|_/ /
echo/_/ /_____//____/_/^|_/___/
echo Support Services Version 1.0
set /a num=%random% %2002%30005
set reportID=%random%
echo Creating report...
for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do set NetworkIP=%%a
echo -----------------------
echo Generating Group Policy Report...
GPRESULT /H %rawResults%REPORT-%reportID%-GP.html
echo Done. Creating System Information report.
(
echo ^<HTML^>
echo ^<BODY^>
echo ^<pre^>
echo ^<h1^>REPORT ID: %reportID%^</h1^>
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"OS Manufacturer" /C:"OS Configuration" /C:"OS Build Type" /C:"Original Install Date" /C:"System Boot Time" /C:"System Manufacturer" /C:"System Model" /C:"System Type" /C:"Processor(s)" /C:"BIOS Version" /C:"Windows Directory" /C:"System Directory" /C:"Boot Device" /C:"System Locale" /C:"Input Locale" /C:"Total Physical Memory" /C:"Available Physical Memory" /C:"Virtual Memory: Max Size" /C:"Virtual Memory: Available" /C:"Virtual Memory: In Use" /C:"Domain" /C:"Network Card(s)"
echo IP Addr: %NetworkIP%
echo Client name: %USERNAME%
echo Hostname: %COMPUTERNAME%
echo View GP report: ^<a href="%rawResults%REPORT-%reportID%-GP.html"^>GP REPORT %reportID%^</a^>
echo ^</pre^>
echo ^</BODY^>
echo ^</HTML^>
)>%rawResults%REPORT-%reportID%-SYSTEMINFO.html
echo Finished.
echo -----------------------
echo Generating technician assistance file...
(
echo @echo off
echo echo Viewing reports for %COMPUTERNAME%/%USERNAME% report ID: %reportID%
echo start iexplore %rawResults%REPORT-%reportID%-GP.html
echo start iexplore %rawResults%REPORT-%reportID%-SYSTEMINFO.html
)>%resultsLocation%REPORT-%reportID%.bat
echo Finished.
echo -----------------------
echo Report for %computername%/%USERNAME%/%NetworkIP%
echo Report ID: %reportID%
echo Created 2 reports : GROUP POLICY : SYSTEM Information
echo -----------------------
echo Tell the technician that your report has been created with the ID %reportID% then press RETURN
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment