Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old February 12th, 2004, 03:16 PM
ricksterval's Avatar
ricksterval ricksterval is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 31 ricksterval User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Set the Autologon Script using WMI

Option Explicit
On Error Resume Next
Err.Clear

dim StdOut, objReg, strKeyPath, strStringValueName, strSetStringValue, strEntryName, strValue, strLoginPath
dim Wshshell, ArgObj, sArgCount, x

Set WshShell = WScript.CreateObject("WScript.Shell")

const HKEY_LOCAL_MACHINE = &H80000002
Set StdOut = WScript.StdOut

strSetStringValue = "c:\winnt\system32\wscript.exe c:\someWSHFile.vbs"
strStringValueName = "Description of the process"

Set ArgObj = WScript.Arguments
sArgCount = ArgObj.Count

For x = 0 to sArgCount - 1
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
ArgObj(x) & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\ ANewRegistryKey"
strLoginPath = "Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "AutoAdminLogon", "1"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "DefaultUserName", "Administrator"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "DefaultPassword", "Password"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "AutoLogonCount", "1"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "DefaultDomainName", ArgObj(x)
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strStringValueName, strSetStringValue
set objReg = Nothing
Next

set wshshell = nothing
set argobj = nothing

Sub ErrorHandler(byVal errornum, byVal errorDesc)
theDesc = "Error Number: " & errornum & " Error Description: " & errorDesc
WshShell.LogEvent 1, theDesc
err.clear
End Sub

Read Complete Article

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Set the Autologon Script using WMI


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway