Client Management Suite

 View Only

Feeding Windows Exit Code to DS / NS 

Aug 14, 2012 01:23 PM

We were needing a method of querying systems to determine if they had a specific registry key enabled.  In our case, we wanted to verify smart card access.  Here is a working script that will tell you yes or no based on the exit code.  Essentially, we are reading the registry, convering it to a single digit value, transferring that into system variable, re-reading that as an exit code, and outputting that to DS / NS.  From here, you have a working template that you can customize to read nearly any registry value you desire.

@echo off
for /f "tokens=*" %%a in ('"REG QUERY HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v scforceoption"') do set REGVAR=%%a
set REGVAR=%REGVAR:~-1%
IF %REGVAR% == 0 GOTO SCOFF
IF %REGVAR% == 1 GOTO SCON
GOTO EXIT
:SCOFF
exit 10001
GOTO EXIT
:SCON
exit 10002
GOTO EXIT
:EXIT
exit 10003

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
txt file
Feeding Windows Exit Code to DS _ NS.txt   309 B   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Related Entries and Links

No Related Resource entered.