[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I ensure that machine(s) in my "WORKGROUP" environment are auto-logging themselves in upon reboot.

Posted on 2014-09-02
9
Medium Priority
?
199 Views
Last Modified: 2014-09-02
Good morning Experts,

I have been using scripting for years to complete various task on both domain and workgroup computers. Currently , I am working with a small workgroup environment (Peer-To-Peer). I simply have my computers auto-logon when they reboot. This is only a test environment, so I am not concerned about the security risk involved here. I just test, test , test.

The scripts below are very simply code snippets that sets auto-logging into a given computer(s) with its appropriate User-name and Password, and then Reboots the machine:


Const HKEY_LOCAL_MACHINE = &H80000002
Computers = Array("GALACTUS","DRDOOM","UOP","REDSKULL","VMWARE")
Computers = Array("GALACTUS")
Set objSWbemLocator = CreateObject _
("WbemScripting.SWbemLocator")
'   On Error Resume Next
For Each Computer In Computers
WScript.Echo "Autologging " & Computer

Set oReg = objSWbemLocator.ConnectServer _
(Computer, "root\default:StdRegProv","ADMINISTRATOR", "THANnos08")
Set StdRegProv = oReg.Get("StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"

strEntryName = "AutoAdminLogon"
strValue = "1"
StdRegProv.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue

strEntryName = "DefaultUserName"
strValue = "THANOS"
StdRegProv.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue

strEntryName = "DefaultPassword"
strValue = "THANnos8"
StdRegProv.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue

Next 

Open in new window



Const SHUTDOWN = 6 
wbemImpersonationLevelImpersonate = 3
wbemAuthenticationLevelPktPrivacy = 6
	Computers = Array("GALACTUS","DRDOOM","UOP","REDSKULL","VMWARE")
	Computers = Array("GALACTUS")
'   On Error Resume Next 
For Each Computer In Computers
	Set objLocator = CreateObject("WbemScripting.SWbemLocator")
	Set objService = objLocator.ConnectServer _
	(Computer, "root\cimv2", "ADMINISTRATOR", "THANnos08")
	objService.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
	objservice.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy
	Set colOperatingSystems = objService.ExecQuery _
	("SELECT * FROM Win32_OperatingSystem")
	For Each objOperatingSystem In colOperatingSystems
		ObjOperatingSystem.Win32Shutdown(SHUTDOWN)
	Next
Next

Open in new window


This code has worked 100%.
I looked at the registry settings for the remote machine and the settings were correct:

!
The reboot script reboots the machine ( works perfectly), but when the machine tries to auto-logon, I get this error:

!
I have tested these scripts on hundreds of windows 8.1 lab machines and they just work. why now, all of a sudden , even though both script run successfully, the machine doesn't auto-logon? It's probably something silly, so the more eyes I have on the code , may yield a solution.


And yes, I logged directly into the local machine to ensure that it has the correct password.

your help is appreciated.
GalactusAutologon1.PNG
0
Comment
Question by:BLACK THANOS
  • 8
9 Comments
 
LVL 57

Accepted Solution

by:
McKnife earned 2000 total points
ID: 40299028
Don't know, but I would use the freeware autologon.exe from Microsoft and the script will become a one-liner and just work.
0
 

Author Comment

by:BLACK THANOS
ID: 40299102
Input appreciated Mcnife
0
 

Author Comment

by:BLACK THANOS
ID: 40299114
McKnife , no Mcnife. Sorry
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:BLACK THANOS
ID: 40299225
The Microsoft community answered my question.

http://answers.microsoft.com/en-us/windows/forum/windows_8-security/reset-security-policies/7a0a0247-393f-4ed5-9066-2723d321a6d5

Specifics:

!
now autologon works like a charm.
0
 

Author Comment

by:BLACK THANOS
ID: 40299608
or alternatively:

this fixes the issue also.

!
0
 

Author Comment

by:BLACK THANOS
ID: 40299672
both of these options work McKnife. I will test the utility you gave me. If it works the points are yours even-though I found two alternative solutions that I have already scripted and work perfectly. I reward points for alternative ways of doing things. All information if valuable . Is this okay with you to give you the points once I test it for myself?
0
 

Author Comment

by:BLACK THANOS
ID: 40299675
I promise to do a bit more research before I come to the EE forum , to avoid these kinds of complications. My rule of thumb is if I can find it in a couple of hours, I go to EE. On this occasion, I simply went EE, breaking my own rule. Sorry.
0
 

Author Comment

by:BLACK THANOS
ID: 40300164
McNife wrote:

Don't know, but I would use the freeware autologon.exe from Microsoft and the script will become a one-liner and just work.

nope , didn't work Mcknife. Yields the same results as my script. I was a bit disappointed because if it worked, I like the axiom of KISS ( Keep it simple stu###) .  I would have used it.
0
 

Author Comment

by:BLACK THANOS
ID: 40300207
I  put the command line args into another machine and it works, with the caveat that it had to work with with elevated privileges. I used Psexec.

thx.
AutoLogon.PNG
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question