PaulRenda Posted August 18, 2014 Posted August 18, 2014 Hello, As anyone had success in executing a batch file (.bat) from the netlogon on a RM CC4.2 network? I need to run a batch file for all users when they logon, but I'm finding hard to find information on RM on how to do this, although quite a few of their TEC articles say it is possible, but no indication on how to accomplish. Thank you.
foofighterjim Posted August 18, 2014 Posted August 18, 2014 What exactly are you trying to achieve? I would always try to find a better way than using a .bat but I believe the following would work (please note that I haven't actually done this myself so you will need to test) 1. To run a batch file you need to ensure that all accounts have "Allow execution of 16-bit and DOS applications" enabled in the rights tab of the user accounts. 2. The .bat needs to be in a location accessible to these accounts. 3. In the relevant User Policy you need to: Disable; Software Restrictions> Disable the command prompt. Add the file; General> Specify programs to run after logon.
PaulRenda Posted August 18, 2014 Author Posted August 18, 2014 Hi foofighterjim, Thanks for that. I got everything up to point 3, but the 'Add the file; General > Specify programs to run after logon I didn't understand. Say I have a file called abc.bat, located on the NETLOGON folder (\\servername\netlogon), which actually points to an executable file abc.exe at the same location. What would I need to write on the Name and Value boxes? Ta.
foofighterjim Posted August 18, 2014 Posted August 18, 2014 This is described better in TEC663412 than what I can put on here. Out of interest why get a bat to reference the exe, why not just run the exe with command line switches if necessary?
PaulRenda Posted August 19, 2014 Author Posted August 19, 2014 Shame that TEC article is for CC3 network. Doesn't quite work the same on CC4.2. This is described better in TEC663412 than what I can put on here. Out of interest why get a bat to reference the exe, why not just run the exe with command line switches if necessary?
PaulRenda Posted August 19, 2014 Author Posted August 19, 2014 Reply from RM Support: "Hi Paul. unfortunately as you say [TEC article] that relates to CC3. There is no method of doing this natively in CC4. You can run them native in Windows but it is not supported by RM." Fantastic. I can't believe that no one has accomplished running an exe/bat file at startup logon on a CC4 network.
Norphy Posted August 19, 2014 Posted August 19, 2014 "Not Supported" isn't the same as "doesn't work". It just means that you're on your own if it doesn't work. You could just try using the native Windows script handlers to see what happens.
jaf Posted August 19, 2014 Posted August 19, 2014 Try putting in (as above) the exe file in RMMC in a user policy - general - "Run these programs after logon". In the Name box just put any name. In value put the full location of the exe or bat file eg \\server\Netlogon\exe.exe -switch if necessary. Works for us!
PaulRenda Posted August 19, 2014 Author Posted August 19, 2014 (edited) jaf, It worked perfectly!!! Try putting in (as above) the exe file in RMMC in a user policy - general - "Run these programs after logon". In the Name box just put any name. In value put the full location of the exe or bat file eg \\server\Netlogon\exe.exe -switch if necessary. Works for us! Edited August 19, 2014 by PaulRenda
PaulRenda Posted August 19, 2014 Author Posted August 19, 2014 I've done a tutorial on how to force a screen resolution on all CC4 computers. How to Force Screen Resolution on CC4 on all Desktops I hope you enjoy it.
Hawkeyez Posted April 2, 2015 Posted April 2, 2015 How abouts doing a boot script (pre-login)? Got a script to clean local profiles I want to run on student laptops.
Hawkeyez Posted April 2, 2015 Posted April 2, 2015 This is the script, now got it running, however, it wont delete users that start with a number! Any ideas. @ECHO ON :: -------------------------------------- :: :: Windows 7 User Profile Cleaning Script :: Version 3.1 :: :: Written by Mike Stone :: [email protected] :: https://mstoneblog.wordpress.com :: :: -------------------------------------- :: :: Welcome! This script is designed to automate the process of flushing :: user profiles within Windows 7, while at the same time preserving :: profiles of your choosing, including domain users. :: :: This script is written as an example of wanting all domain users wiped :: except for the one called "pctest". :: :: Portions of the script that will require manual edits will be preceded :: by instructions with these "double colon" comment marks. :: :: Please let me know how well (or not well) this works for you or any :: features you can think of that could be added. :: :: -------------------------------------- title Windows 7 User Profile Cleaning :: ---------- :: Add any users you wish to exclude from the wipe to the "userpreserve" :: line below and separate them by commas. Be careful - these are :: case-sensitive. :: ---------- :USERPRESERVE set userpreserve="Administrator,All Users,UpdatusUser,Default,Default User,Public,pctest,RM Default User,Public,systemadmin,CLW [email protected]AL" FOR /f "tokens=*" %%a IN ('reg query "hklm\software\microsoft\windows nt\currentversion\profilelist"^|find /i "s-1-5-21"') DO CALL :REGCHECK "%%a" GOTO VERIFY :REGCHECK set SPACECHECK= FOR /f "tokens=3,4" %%b in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATH=%%b %%c FOR /f "tokens=2" %%d in ('echo %USERREGPATH%') DO SET SPACECHECK=%%d IF ["%SPACECHECK%"]==[""] GOTO REGCHECK2 GOTO USERCHECK :REGCHECK2 FOR /f "tokens=3" %%g in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATH=%%g GOTO USERCHECK :USERCHECK FOR /f "tokens=3 delims=" %%e in ('echo %USERREGPATH%') DO SET USERREG=%%e FOR /f "tokens=1 delims=." %%f IN ('echo %USERREG%') DO SET USERREGPARSE=%%f ECHO %USERPRESERVE%|find /I "%USERREGPARSE%" > NUL IF ERRORLEVEL=1 GOTO CLEAN IF ERRORLEVEL=0 GOTO SKIP :SKIP ECHO Skipping user clean for %USERREG% GOTO :EOF :CLEAN ECHO Cleaning user profile for %USERREG% rmdir "C:\Users\%USERREG%" /s /q > NUL ECHO Cleaning user registry for %USERREG% reg delete %1 /f IF EXIST "C:\Users\%USERREG%" GOTO RETRYCLEAN1 GOTO :EOF :RETRYCLEAN1 ECHO Retrying clean of user profile %USERREG% rmdir "C:\Users\%USERREG%" /s /q > NUL IF EXIST "C:\Users\%USERREG%" GOTO RETRYCLEAN2 GOTO :EOF :RETRYCLEAN2 ECHO Retrying clean of user profile %USERREG% rmdir "C:\Users\%USERREG%" /s /q > NUL GOTO :EOF :VERIFY FOR /f "tokens=*" %%g IN ('reg query "hklm\software\microsoft\windows nt\currentversion\profilelist"^|find /i "s-1-5-21"') DO CALL :REGCHECKV "%%g" GOTO REPORT :REGCHECKV set SPACECHECKV= FOR /f "tokens=3,4" %%h in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATHV=%%h %%i FOR /f "tokens=2" %%j in ('echo %USERREGPATHV%') DO SET SPACECHECKV=%%j IF ["%SPACECHECKV%"]==[""] GOTO REGCHECKV2 GOTO USERCHECKV :REGCHECKV2 FOR /f "tokens=3" %%k in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATHV=%%k GOTO USERCHECKV :USERCHECKV FOR /f "tokens=3 delims=" %%l in ('echo %USERREGPATHV%') DO SET USERREGV=%%l FOR /f "tokens=1 delims=." %%m IN ('echo %USERREGV%') DO SET USERREGPARSEV=%%m ECHO %USERPRESERVE%|find /I "%USERREGPARSEV%" > NUL IF ERRORLEVEL=1 GOTO VERIFYERROR IF ERRORLEVEL=0 GOTO :EOF :VERIFYERROR SET USERERROR=YES GOTO :EOF :REPORT IF [%USERERROR%]==[YES] ( set RESULT=FAILURE ) ELSE ( set RESULT=SUCCESS ) :: ---------- :: This is fairly optional - it's just something I added so :: that I could keep an eye on the labs remotely to make :: sure there weren't masses of critical errors with the :: script failing. :: :: If you don't want it, just comment-out or remove the :: "net use" line. :: :: If you do want it, then make the necessary modifications :: to the net use to map an appropriate sharepoint. :: ---------- :: net use t: \\server\share IF EXIST "t:\labreport.txt" ( GOTO REPORTGEN ) ELSE ( GOTO EXIT ) :REPORTGEN FOR /F "tokens=*" %%n in ('echo %date:~10,4%-%date:~4,2%-%date:~7,2% %time:~0,2%-%time:~3,2%-%time:~6,2%') DO SET TDATETIME=%%n FOR /F "tokens=14" %%o in ('ipconfig^|find "IPv4 Address"') DO SET IPNUMBER=%%o ECHO. %RESULT% %COMPUTERNAME% %IPNUMBER% %TDATETIME%>>"t:\labreport.txt" net use t: /delete GOTO EXIT :EXIT exit :EOF
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now