Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reboot and login scripts 1

Status
Not open for further replies.

wwgmr

MIS
Mar 12, 2001
174
US
Hi, I wanted to ask if anyone can help with this issue, I searched for info on it and seems everyone post had no replies.

What I'm looking to do is write script to reboot windows and relog into the same user. I have found many ways, but I don't want to request or enter in the user name or password into the code. Is it possible for the code to use what is local on each machine to do this?

If it isn't possible let me know. I'm trying to avoid all the third party apps.

Cheers
 
Rebooting is easy. You can either use WMI or Shutdown.exe.

You can not however perform an autologon unless you already knwo the password. If you do you could script adding the credentials to the registry for the reboot and then use a login script executed from the run once to remove those registry settings.

So while it is possible, this is a terrible configuration which introduces all kinds of security problems.

What is your end goal that you are trying to do. Perhaps we can assist with that better.

I hope you find this post helpful.

Regards,

Mark
 
I remote to friends and client systems to help them with problems. They will go afk for awhile while I'm doing installs and MS Updates. Most updates will want to restart. I can get windows to reconnect with no problem if its using default for user and no password. What causes hang up is if need prompt and select of that user or if they have another profile.

From what I've been reading it doesnt look like this is possible yet, I have worked with IT companies that use script to do this. So I know it should be in theory. So I'm trying to learn the steps needed.

As I work with different systems I was working to make it uniformed. That way I wouldn't have to edit to supply a User name and password for each system. If I'm working with 20 systems for update can be pain to edit each. Work smarter not harder as they say.

Thanks for quick reply. I'm know enough to see the road just not enought to drive fast down it.
 
Hi again wanted to update and pose the new problem I'm having.

I found simple way to have remote user enter in the information by using prompt.
My problem is code requires download on each system of wscript.

Is there way to write in either java or windows code to do the following?
The Prompt command works as simple VB if I'm not mistaken. It is when I get to the OWSH I think I have problem.


' get domain
Prompt = "Enter the autologon user domain for " & UserName
Userdomain = InputBox(Prompt, Title, "")

' now set these in the registry
oWSH.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon","1","REG_SZ"
oWSH.RegWrite "HKLM\SOFTWARE\Microsoft\Windows 'NT\CurrentVersion\Winlogon\DefaultDomainName", UserDomain, "REG_SZ"
oWSH.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", UserName, "REG_SZ"
oWSH.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", UserPass, "REG_SZ"

Thanks!
 
You have not declared what oWSH is. Since you are doing a regwrite it has to be the shell so you need to add this to the top of your script:

Set oWSH = CreateObject("WScript.Shell")


I hope you find this post helpful.

Regards,

Mark
 
Mark, Thank you very much. Shows how knowing a little code can get you into trouble. Instead of using as you posted

Set oWSH = CreateObject("WScript.Shell")

I had used
Set oWSH = WScript.CreateObject("WScript.Shell")

Which was causing line error.

Thank you very much simple change makes all the diff.

Works perfect now.

 
It would be really hard pressed to reach that conclusion if the only substantive functionality of the script is what already shown!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top