Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

Create a local User Account using Classic ASP

$
0
0

Hi,

I've got a requirement to allow a remote user permissions to create a local user account and add it to a particular group on a server.  I have the VBScript code for this but my Classic ASP is not so good.  Does anyone have any pointers please

Set objShell = CreateObject("Wscript.Shell") 
 
Set objEnv = objShell.Environment("Process") 
strComputer
= objEnv("COMPUTERNAME") 
strUser
= inputbox("Enter the username for the new admin account.") 
strPass
= inputbox("Enter the password for the new account.") 
 
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer") 
 
Set objUser = colAccounts.Create("user", strUser) 
 
objUser
.SetPassword strPass 
 
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 
objPasswordExpirationFlag
= ADS_UF_DONT_EXPIRE_PASSWD 
objUser
.Put "userFlags", objPasswordExpirationFlag 
 
objUser
.SetInfo  
 
Set Group = GetObject("WinNT://" & strComputer & "/Administrators,group") 
Group
.Add(objUser.ADspath)

 

Thanks


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>