I GOT IT WORKING FINALLY!
Functions:
1. account logs in
2. shortcut under startup runs the vb script
3. gpudpate is ran
4. the script deletes the shortcut and itself
5. system reboots
6. computer is left at ctrl+alt+del
SCCM 2012:
At first I tried to use a runonce registry entry line to do the gpupdate and a reboot, however after sccm releases the os the runonce lines are not ran until a actual user logs in and off once. To fix this we used the startup folder to call a script which does the runonce actions.
In Task Sequence the Last step is set to run this application, for me I used a detection method of the domain name reg key.
SCCM Package
1. create .bat or .vbs to do the following (not provided) to do the following
1. runs the autologin.vbs
2. copies or creates a updateandreboot.lnk to the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\ which points to the updateandreboot.vbs
3. copies the updateandreboot.vbs to c:\windows\temp\
autologin.vbs
Const HKEY_CLASSES_ROOT = &h80000000
Const HKEY_CURRENT_USER = &h80000001
Const HKEY_LOCAL_MACHINE = &h80000002
Const HKEY_USERS = &h80000003
Const HKEY_CURRENT_CONFIG= &h80000005
Const HKEY_DYN_DATA = &h80000006
sUsername = "domainaccount"
sPassword = "yourdomainpassword"
sDomain = "yourdomain"
strRegKey = "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\"
Write64BitRegistry "REG_SZ", HKEY_LOCAL_MACHINE, strRegKey, "AutoAdminLogon", "1"
Write64BitRegistry "REG_SZ", HKEY_LOCAL_MACHINE, strRegKey, "DefaultUserName", sUsername
Write64BitRegistry "REG_SZ", HKEY_LOCAL_MACHINE, strRegKey, "DefaultDomainName", strComputer
Write64BitRegistry "REG_SZ", HKEY_LOCAL_MACHINE, strRegKey, "DefaultPassword", sPassword
Write64BitRegistry "REG_SZ", HKEY_LOCAL_MACHINE, strRegKey, "DefaultDomainName", sDomain
Write64BitRegistry "REG_SZ", HKEY_LOCAL_MACHINE, strRegKey, "ForceAutoLogon", 1
Write64BitRegistry "REG_DWORD", HKEY_LOCAL_MACHINE, strRegKey, "AutoLogonCount", 1
Write64BitRegistry "REG_DWORD", HKEY_LOCAL_MACHINE, strRegKey, "DisableCAD", 1
Sub Write64BitRegistry (strRegType, strRootKey, strKey, strValueName, strValue)
Dim objCtx, objLocator, objReg, intReturnCode
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 64
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objReg = objLocator.ConnectServer("", "root\default", "", "", , , , objCtx).Get("StdRegProv")
If Ucase(strRegType) = "KEY" Then
intReturnCode = objReg.CreateKey(strRootKey,strKey)
End If
If Ucase(strRegType) = "REG_DWORD" Then
intReturnCode = objReg.SetDWORDValue(strRootKey,strKey,strValueName,strValue)
End If
If Ucase(strRegType) = "REG_SZ" Then
intReturnCode = objReg.SetStringValue(strRootKey,strKey,strValueName,strValue)
End If
If Ucase(strRegType) = "REG_EXPAND_SZ" Then
intReturnCode = objReg.SetExpandedStringValue(strRootKey,strKey,strValueName,strValue)
End If
If Not intReturnCode = 0 Then
'Failed to set the registry entry
End If
End Sub
Create a Shortcut that calls the vbs called UpdateandReboot.lnk
UpdateandReboot.vbs
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")
'deletes the shortcut
objShell.Run "cmd /c del /q "&chr(34)&"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\UpdateandReboot.lnk"&chr(34), 0, True
'wscript.echo "cmd /c del /q "&chr(34)&"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\UpdateandReboot.lnk"&chr(34)
'runs gpupdate and reboots
objShell.Run "cmd /k gpupdate"&chr(38)&chr(38)&"shutdown -r -f -t 10", 0, True
'deletes itself
strScript = Wscript.ScriptFullName
objFSO.DeleteFile(strScript)