I often use the Novell login script for my own purposes, one of them being a quick hardware audit of any desktop I touch. I’ve noticed that not everything works when running my batch locally, but rarely ever does it work the second the Novell login script fires it off. I had to figure out why this was any different. Running as another user perhaps? Running as a restricted account?
You’ll notice that basic commands can be launched globally, for example you can run ‘notepad.exe’ from c:\ in a dos prompt regardless that notepad actually exists in another folder, decide to suddenly not be found when run in a Novell script. Often you’ll know when the login script fails as it will fly through quickly without having anything done, or you’ll see a blip of a command line screen fade away as quickly as it came in. If you put a pause or save the output on your commands you’ll likely see:
“{Your command} is not recognized as an internal or external command, operable program or batch file.”
What I eventually did was run the set command in a batch file. A set command run gave me this result, when running locally as a regular file and not as part of a Novell login script:
ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\Mike\AppData\Roaming CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=MIKEPC ComSpec=C:\Windows\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Users\Mike INTEL_DEV_REDIST=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\ LOCALAPPDATA=C:\Users\Mike\AppData\Local LOGONSERVER=\\MIKEPC NUMBER_OF_PROCESSORS=4 NWLANGUAGE=ENGLISH OS=Windows_NT Path=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\c ompiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\c ompiler;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Program Files \Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\ Microsoft Shared\Windows Live;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Prog ram Files (x86)\Universal Extractor;C:\Program Files (x86)\Universal Extractor\b in;C:\Program Files (x86)\Bitvise Tunnelier;C:\Program Files\Microsoft Windows P erformance Toolkit;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C: \Program Files (x86)\Microsoft SQL Server\100\DTS\Binn;C:\Program Files\Windows Imaging;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Mi crosoft SQL Server\100\DTS\Binn;C:\Program Files\SAS\SharedFiles(32)\Formats;C:\ Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Novell\ZENworks\b in;C:\Program Files (x86)\Smart Projects\IsoBuster;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program File s (x86)\Windows Kits\8.0\Windows Performance Toolkit;c:\Program Files (x86)\Micr osoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools \Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86 )\Novell\GroupWise;C:\Program Files (x86)\QuickTime\QTSystem\;V:. PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=170a ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public QTJAVA=C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\Mike\AppData\Local\Temp TKPATHX8664=C:\Program Files\SAS\SharedFiles\ICU TMP=C:\Users\Mike\AppData\Local\Temp USERDOMAIN=MIKEPC USERNAME=Mike USERPROFILE=C:\Users\Mike windir=C:\Windows WINDOWS_LOGIN=0
Note that these variables can be referenced in any batch script as a variable, for example:
C:\Users\Mike>echo %PROCESSOR_LEVEL% 6 C:\Users\Mike>
Note the huge long global paths of all my wonderful programs in the local batch. Now here is what gets pulled from running the batch file via login script:
ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\Mike\AppData\Roaming CLASSPATH=.;C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip CLIENTNAME=MIKEPC CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=MIKEPC ComSpec=C:\Windows\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Users\Mike INTEL_DEV_REDIST=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\ LOCALAPPDATA=C:\Users\Mike\AppData\Local LOGONSERVER=\\MIKEPC NUMBER_OF_PROCESSORS=4 NWLANGUAGE=ENGLISH OS=Windows_NT Path=V:. PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=170a ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public QTJAVA=C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\Mike\AppData\Local\Temp TMP=C:\Users\Mike\AppData\Local\Temp USERDOMAIN=MIKEPC USERNAME=Mike USERPROFILE=C:\Users\Mike windir=C:\Windows WINDOWS_LOGIN=1
Note the glaring Path=V:.
The workaround here, use full paths for everything you use. You’ll have to be conscious about targeting locations such as Program Files (i.e. Program Files or Program Files (x86)) if you are running the script to target different operating system versions (i.e. Win 7 x86, Win 7 x64, Win Xp).
No Comments
There are no comments related to this article.
Leave a Reply