Need to display a logon batch file to domain users to allow set /p user input
I have a logon script with is working perfectly, however it doesn't allow the user to input their responses and therefore triggers the timeout that I've built into it. How can I get Windows 7 to display the batch file as it runs - like it used to in the
old days.
I understand that it's a nicer experience for the user if they can't see the inner workings, but I need them to input information!
I therefore either need to display it, or have pop-up boxes to allow them to input data.
The code I have so far is below - I have removed the timeout and have used js popups, but they're not displaying.
@echo off
REM Version 1.6
cls
REM set OVERWRITE=OFF for normal functionality
REM OVERWRITE=ON will force-overwrite user's signature
set OVERWRITE=ON
REM sets output log files
set FILENAME=done
set FILENAME2=log
set FILETYPE=csv
cls
REM this version uses a variable for OS version
REM tests if user inputted into database
find /c /i "%USERNAME%" "z:\temp\signatures\%FILENAME%.%FILETYPE%" > NUL
if %errorlevel% == 0 (
echo FOUND! Your signature has been set up already,
echo Please check in Outlook to confirm
echo Exiting...
echo %date%,%time%,%username%,file-found >> "z:\temp\signatures\%FILENAME%.%FILETYPE%"
exit
) else (
echo %USERNAME% not found in log - continuing...
)
REM tests windows version and sets variable
IF EXIST "%userprofile%\Application Data\Roaming\Microsoft\Signatures\" (
echo OS is XP
set AD=Application Data
) ELSE (
echo OS is Win7
set AD=AppData
)
echo %AD%
goto %OVERWRITE%
:OFF
REM tests if files already copied
IF EXIST "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard.txt" (
echo %date%, %time%, %username%, already done >> "z:\temp\signatures\%FILENAME%.%FILETYPE%"
echo files already copied, exiting
Pause
) ELSE (
:ON
echo copying files
md "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard_files"
copy "z:\temp\signatures\Architen_Standard.*" "%userprofile%\%AD%\Roaming\Microsoft\Signatures\"
copy "z:\temp\signatures\Architen_Standard_files\*.*" "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard_files\"
)
:2
> usermessage.vbs ECHO WScript.Echo InputBox( "Please enter Job Description as you would like it to appear on your signature", "ALA Signature Generator 1/3", "i.e. Project Manager" )
FOR /F "tokens=*" %%A IN ('CSCRIPT.EXE //NoLogo usermessage.vbs') DO SET JD=%%A
DEL usermessage.vbs
> usermessage.vbs ECHO WScript.Echo InputBox( "Enter 3 digit internal extension", "ALA Signature Generator 2/3", "i.e. 200" )
FOR /F "tokens=*" %%B IN ('CSCRIPT.EXE //NoLogo usermessage.vbs') DO SET EX=%%B
DEL usermessage.vbs
set MO=[NONE]
> usermessage.vbs ECHO WScript.Echo InputBox( "Enter your mobile number WITHOUT initial 0, i.e. 7843628000. Click CANCEL if you do not have a company mobile", "ALA Signature Generator", "" )
FOR /F "tokens=*" %%C IN ('CSCRIPT.EXE //NoLogo usermessage.vbs') DO SET TEMPMO=%%C
DEL usermessage.vbs
IF (%TEMPMO%)==() goto skip
set MO=+44 (0) %TEMPMO%
:skip
:1
echo Please wait...
echo (over VPN this can take some time)
echo %date%,%time%,%username%,"%JD%",%EX%,%MO% >> "z:\temp\signatures\%FILENAME2%.%FILETYPE%"
echo %date%,%time%,%username%,completed >> "z:\temp\signatures\%FILENAME%.%FILETYPE%"
set star=htm
set marker=0
:return
REM -q switch supresses output
set /a marker=%marker%+1
Z:\Temp\Signatures\fart.exe -q "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard.%STAR%" "[NAME]" "%USERNAME%"
Z:\Temp\Signatures\fart.exe -q "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard.%STAR%" "[JOB_TITLE]" "%JD%"
Z:\Temp\Signatures\fart.exe -q "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard.%STAR%" "[EXT]" "%EX%"
Z:\Temp\Signatures\fart.exe -q "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard.%STAR%" "[MOBILE]" "m: %MO%"
Z:\Temp\Signatures\fart.exe -q --remove "%userprofile%\%AD%\Roaming\Microsoft\Signatures\Architen_Standard.%STAR%" "m: [NONE]"
cls
if %marker% == 3 goto rundown
if %marker% == 2 (set star=txt
goto return
)
if %marker% == 1 (set star=rtf
goto return
)
:rundown
echo Please check your signature in Outlook 2010 by going to:
echo File...
echo .......Options...
echo .................Mail...
echo ........................Signatures...
Pause
exit
Any ideas? It works absolutely fine if it is executed manually, just for the login script it doesn't display anything, not a sausage!
We're running Exchange 2003 hence the requirement of this and the reluctance to a) install anything on the server and b) buy additional software for a 100-user domain environment.
February 28th, 2011 12:44pm
Hi,
What is your script extension? According some feedbacks, I found that .CMD scripts have a hard time running in a domain because of UAC. However .VBS seem to work fine.
Also make sure you have set the correct GPO on Server. Regarding the settings on GPO, you can contact Windows Server Forum.
Win Server Forum
http://social.technet.microsoft.com/Forums/en-US/category/windowsserver
Best Regards,
NikiPlease remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
March 3rd, 2011 4:55am