I want to run an exe from the task scheduler but would like to logoff the computer. Thus I would need to have the exe press ctrl-alt-del to get the password box up and then script the logon credentials.
How can I do this?
how do I get macro scheduler to press ctrl-alt-del
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
You will not be able to make it do CTL-ALT-DEL, so save your time. But the ShutDownWindows> command works great. From the Help file:
I have a Dialog that I created and compiled and is used on many of my clients' systems. It provides the option to Log Out, Reboot, or Restart. It also has a combo box to select some comments. And the results are written to a log file, so we now have a complete log of this command. I have removed ShutDown from their Start menu and replaced it with an icon that calls up this dialog.ShutDownWindows>shutdown_type
Use this command to shutdown or reboot the machine. Set shutdown_type appropriatly as follows:
0: Shutdown
1: Reboot
2: Logoff
3: Forced Shutdown
4: Forced Reboot
5: Forced Logoff
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Shutdown dialog
Bob,
Thanks for the info. Could you send em the dialog piece of your script so I can take a look at it. I also need to prompt them for what they would like to do and I was thinking I could have them check off boxes instead of asking them question after question.
Thanks, Dave
Thanks for the info. Could you send em the dialog piece of your script so I can take a look at it. I also need to prompt them for what they would like to do and I was thinking I could have them check off boxes instead of asking them question after question.
Thanks, Dave
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
This is a script that I have not reviewed since it was "done" about 18 months ago. Definitely still has some unfinished bricks in place, that's how it goes, lots of unfulfilled plans.. No time rightnow to clean it up for you, all the extra garbage is free. I have bolded the pure Dialog section.
If you Cut/Paste from the forum, be sure to use the tools in the Editor to remove Trailing Spaces. Click on Edit, Show All Characters, and Remove Trailing Spaces.
There are certainly areas to be improved, and still need to activate the Run Program sections, but may never get to them. This is working adequately for now.//Define macro variables
//Logging out is writtten to three logs: 1 for each user, one for each computer, and one for entire network.
Let>UserPath=F:\PUBLIC\SCRIPTS\Log
Let>UserFile=%USER_NAME%login.LOG
Let>PCPath=F:\PUBLIC\SCRIPTS\Log
Let>PCFile=%COMPUTER_NAME%_login.LOG
Let>NetworkPath=F:\PUBLIC\SCRIPTS\Log
Let>NetworkFile=_login.log
//Need to check for existing paths and files
//Provide ability to modify each logoff without changing compiled Macro Scheduler.
//May be different for Logoff, reboot, or shutdown...handles all.
//Just create Batch files that are called before Logout happens.
Let>LogOffPath=F:\BATCH
Let>LogOffFile=LogOff.bat
Let>ReBootPath=F:\BATCH
Let>ReBootFile=ReBoot.bat
Let>ShutDownPath=F:\BATCH
Let>ShutDownFile=ShutDown.bat
//Need to check for existing paths and files
Let>DefaultAction=Log Off
Let>WindowsExit.Action=%DefaultAction%
Let>DefaultReason=Normal-end of work
Let>WindowsExit.Reason=%DefaultAction%
Let>DefaultOther=
//Remove REM to force actions. Need to Prompt to Force Action?
//Should add this decision to Dialog box in future....Force Actiion?
//Let>ForceAction=True
Let>Choice=
Let>RP_WAIT=1
//Let>MSG_STAYONTOP=1
Let>ComboHelp=Log Off allows Log on as a new user.%CRLF%Shut Down turns off power.%CRLF%Re Boot restarts computer
GetDate>Date
GetTime>Time
DayOfWeek>Weekday
Goto>Day%Weekday%
Label>Day1
Let>DOW=Sunday
Goto>Start
Label>Day2
Let>DOW=Monday
Goto>Start
Label>Day3
Let>DOW=Tuesday
Goto>Start
Label>Day4
Let>DOW=Wednesday
Goto>Start
Label>Day5
Let>DOW=Thursday
Goto>Start
Label>Day6
Let>DOW=Friday
Goto>Start
Label>Day7
Let>DOW=Saturday
Goto>Start
Label>Start
//This is beginning of Dialog to Logoff, Reboot, Shutdown
Dialog>WindowsExit
Caption=Shut Down Windows
Top=144
Width=315
Left=312
Height=230
Label=What do you want the computer to do?,56,16
Label=%ComboHelp%,34,72
Label=Reason:,21,112
Label=Enter Other Reason / optional Note,125,112
Button=OK,28,160,75,25,1
Button=Cancel,120,160,75,25,2
Button=Help,212,160,75,25,3
ComboBox=Action,82,40,145,%DefaultAction%%CRLF%Re Boot%CRLF%Shut Down
ComboBox=Reason,8,128,121,%DefaultReason%%CRLF%Low Resources%CRLF%Problem noted here:%CRLF%Required by System%CRLF%Software Change%CRLF%System is hung%CRLF%Testing%CRLF%See Other Reason:
Edit=Other,136,128,164,%DefaultOther%
EndDialog>WindowsExit
//Prompt User to select method of Shutdown
Label>ShowWindow
Show>WindowsExit,Button
//Cancelling form will make Button=2
Goto>%Button%
//Help Button
Label>3
//Provide modal instructions
MessageModal>This is a HELP window to explain how this works
Let>DefautlAction=%WindowsExit.Action%
Let>DefautlReason=%WindowsExit.Reason%
Goto>ShowWindow
//Cancel Button
Label>2
Goto>Cancel
//OK Button
Label>1
//Some conditions require entry in Reason field, some don't.force if empty.
If>%WindowsExit.Action%=,Errors
If>%WindowsExit.Reason%=,Errors
If>%WindowsExit.Reason%See Other Reason:,Continue
If>%WindowsExit.Other%=,Errors,Continue
Label>Errors
MessageModal>Missing Action or Reason
Goto>ShowWindow
Label>Continue
Goto>%WindowsExit.Action%
Label>Shut Down
Let>Choice=0
//Forced Shut Down
//Let>Choice=3
//Insert actions to run on Shut Down
WriteLn>%UserPath%\%UserFile%,result,%DOW%, %Date% %Time%:%USER_NAME% Shutting Down computer %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
WriteLn>%PCPath%\%PCFile%,result,%DOW%, %Date% %Time%:%USER_NAME% Shutting Down computer %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
WriteLn>%NetworkPath%\%NetworkFile%,result,%DOW%, %Date% %Time%:%USER_NAME% Shutting Down computer %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
//Run Program>%ShutDownPath%\%ShutDownFile%
Goto>End
Label>Re Boot
Let>Choice=1
//Forced Re Boot
//Let>Choice=4
//Insert actions to run on Re Boot
WriteLn>%UserPath%\%UserFile%,result,%DOW%, %Date% %Time%:%USER_NAME% ReBooting computer %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
WriteLn>%PCPath%\%PCFile%,result,%DOW%, %Date% %Time%:%USER_NAME% ReBooting computer %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
WriteLn>%NetworkPath%\%NetworkFile%,result,%DOW%, %Date% %Time%:%USER_NAME% ReBooting computer %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
//Run Program>%ReBootPath%\%ReBootFile%
Goto>End
Label>Log Off
Let>Choice=2
//Forced Log Off
//Let>Choice=5
//Insert actions to run on Log Off
WriteLn>%UserPath%\%UserFile%,result,%DOW%, %Date% %Time%:%USER_NAME% Logging Out from %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
WriteLn>%PCPath%\%PCFile%,result,%DOW%, %Date% %Time%:%USER_NAME% Logging Out from %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
WriteLn>%NetworkPath%\%NetworkFile%,result,%DOW%, %Date% %Time%:%USER_NAME% Logging Out from %COMPUTER_NAME%.-//-%WindowsExit.Reason% %WindowsExit.Other%.
//Run Program>%LogOffPath%\%LogOffFile%
Goto>End
//NOTES=====================================
//Need default value for Combo box
//Need Combo Help window to change based on ComboBox value
//Closing Dialog with "X" continues macro, need to add notes to Help about where that continues.
//Closing with "X" is same as Button=2?
//Closing with "X" keeps values of variables, such as combo box
//Line pointer stays at Dialog line
//Need library of Dialogs
//Edit/Memo box not available if no initial value
//Sensitive help not available on Dialog object lines, only on Dialog
//Combo Box needs user defined at time of use...not in list.
//Combo Box Ability to modify existing value
//If need to reshow Dialog, how to keep values already entered?
//Need Message Box on top to see message box.
//Cannot respond to Message Box from Dialog, even with Message on Top
//No indication that horizontal scroll bar will show up on Dialog
//Need to see outline of Label box.on form while designing.
Label>End
//Messages are for test purposes only
//Added Waits to help troubleshoot Logoff error messages..no change....
If>%ForceAction%True,End2
Let>Choice=%Choice%+3
Label>End2
Wait>2
//Message> %USER_NAME%, you have decided to %WindowsExit.Action%.%CRLF%Windows will close %COMPUTER_NAME% using Option %Choice%.
Wait>2
//Added Novell Logout to help troubleshoot Logoff error messages..no change....
//Run Program>I:\Public\logout.exe
Wait>2
ShutDownWindows>%Choice%
Label>Cancel
If you Cut/Paste from the forum, be sure to use the tools in the Editor to remove Trailing Spaces. Click on Edit, Show All Characters, and Remove Trailing Spaces.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
ctrl-alt-del
You can also use freeware utilities to send a ctrl-alt-del and pass a password to the default username. I do it with logon.exe (freeware utility) and Windows XP all the time. Lets me get into a locked desktop and then start running macros.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Just got a chance to review the script I provided earlier.
Did not realize how many extra features were included.
Here is a stripped down untested version:
And like Lumumba, I googled for logon.exe (and login.exe) without success. A link to that program would be appreciated. If no link known, perhaps checking properties of file will identify manufacturer and other clues to help locate a source for it?
Did not realize how many extra features were included.
Here is a stripped down untested version:
I am sure this will be easier to work with. I removed all the sections that were there for alternate logout scripts and multiple types of logs. No option here for "forced" logouts either.//Define macro variables
LetChoice=
Let>DefaultAction=Log Off
Let>WindowsExit.Action=%DefaultAction%
Label>Start
//This is beginning of Dialog to Logoff, Reboot, Shutdown
Dialog>WindowsExit
Caption=Shut Down Windows
Top=144
Width=315
Left=312
Height=160
Label=What do you want the computer to do?,56,16
Button=OK,48,80,75,25,1
Button=Cancel,140,80,75,25,2
ComboBox=Action,82,40,145,%DefaultAction%%CRLF%Re Boot%CRLF%Shut Down
EndDialog>WindowsExit
//Prompt User to select method of Shutdown
Label>ShowWindow
Show>WindowsExit,Button
//Cancelling form will make Button=2
Goto>%Button%
//Cancel Button
Label>2
Goto>Cancel
//OK Button
Label>1
Goto>%WindowsExit.Action%
Label>Shut Down
Let>Choice=0
Goto>End
Label>Re Boot
Let>Choice=1
Goto>End
Label>Log Off
Let>Choice=2
Goto>End
Label>End
ShutDownWindows>%Choice%
Label>Cancel
And like Lumumba, I googled for logon.exe (and login.exe) without success. A link to that program would be appreciated. If no link known, perhaps checking properties of file will identify manufacturer and other clues to help locate a source for it?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Aargggh!. I just realized you wanted CTL-ALT-DEL to Login, not to Logout!
So obviously the scripts I provided will not do the trick.
But speaking of tricks, here is a method I have used to login into a system that requires CTL-ALT-DEL for the login name/password box:
I have a scheduled Macro Scheduler script call up a remote session of pcAnyWhere(PCA), connect to the computer that has PCA in the host mode. I then use MouseMoveRel to position mouse over the icon for CTL-ALT-DEL, left click the mouse and up comes the Login Dialog.
My macro continues to do the login, then moves to an icon on the desktop, and activates that icon to call up another Macro Scheduler script. When that task is done, I then have the original script move the mouse, clickin on Start, Shutdown, etc. to do a normal logoff, then disconnect the PCA connection.
This is done to a remote machine, but it may possibly work if you can get PCA to dial up to itself, maybe use 127.0.0.1 for the IP? You could probably stop the script once the Login window comes up, if all you want to do is bring up that window for manual entry.
===========================
Hmmm...here is your original request again:
You said that you wanted to logoff. But the description you provided was to do a logon. Was the use of logoff in your original question a mistake?
So obviously the scripts I provided will not do the trick.
But speaking of tricks, here is a method I have used to login into a system that requires CTL-ALT-DEL for the login name/password box:
I have a scheduled Macro Scheduler script call up a remote session of pcAnyWhere(PCA), connect to the computer that has PCA in the host mode. I then use MouseMoveRel to position mouse over the icon for CTL-ALT-DEL, left click the mouse and up comes the Login Dialog.
My macro continues to do the login, then moves to an icon on the desktop, and activates that icon to call up another Macro Scheduler script. When that task is done, I then have the original script move the mouse, clickin on Start, Shutdown, etc. to do a normal logoff, then disconnect the PCA connection.
This is done to a remote machine, but it may possibly work if you can get PCA to dial up to itself, maybe use 127.0.0.1 for the IP? You could probably stop the script once the Login window comes up, if all you want to do is bring up that window for manual entry.
===========================
Hmmm...here is your original request again:
I was right the first time.I want to run an exe from the task scheduler but would like to logoff the computer. Thus I would need to have the exe press ctrl-alt-del to get the password box up and then script the logon credentials.
You said that you wanted to logoff. But the description you provided was to do a logon. Was the use of logoff in your original question a mistake?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!