Hi
I have a script that works as long as the PC/Laptop is logged on to our domain. However, I need certain users to be able to run the script from their PC/Laptop when not logged on to that domain.
Any ideas pleas?
Code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Const ADS_SECURE_AUTHENTICATION = 1
Dim objRoot, objDomain, objOU, objUser, objRootDSE
Dim strUser, strPassword
Dim strContainer, strLastUser, strDNSDomain, intAccValue
strAdminUser = "mydomain\vbs.admin"
strPassword = "P455W0RD"
Set objRoot = GetObject("LDAP:")
Set objDomain = objRoot.OpenDSObject("LDAP://dc=mydomain,dc=local",strAdminUser,strPassword,ADS_SECURE_AUTHENTICATION)
' Set the value to enable the account(S) [512 = Enable, 514 = Disable]
intAccValue = 512
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ~~~~~ Change OU= to reflect desired OU ~~~~~
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set objOU = GetObject("LDAP://ou=Exam Accounts,ou=Students,ou=Brookfield Users, dc=brookfield, dc=local")
For each objUser in objOU
If objUser.class="user" then
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ~~~~~ Enable/disable users ~~~~~
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
objUser.Put "userAccountControl", intAccValue
objUser.SetInfo
End if
next
' End
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have a script that works as long as the PC/Laptop is logged on to our domain. However, I need certain users to be able to run the script from their PC/Laptop when not logged on to that domain.
Any ideas pleas?
Code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Const ADS_SECURE_AUTHENTICATION = 1
Dim objRoot, objDomain, objOU, objUser, objRootDSE
Dim strUser, strPassword
Dim strContainer, strLastUser, strDNSDomain, intAccValue
strAdminUser = "mydomain\vbs.admin"
strPassword = "P455W0RD"
Set objRoot = GetObject("LDAP:")
Set objDomain = objRoot.OpenDSObject("LDAP://dc=mydomain,dc=local",strAdminUser,strPassword,ADS_SECURE_AUTHENTICATION)
' Set the value to enable the account(S) [512 = Enable, 514 = Disable]
intAccValue = 512
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ~~~~~ Change OU= to reflect desired OU ~~~~~
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set objOU = GetObject("LDAP://ou=Exam Accounts,ou=Students,ou=Brookfield Users, dc=brookfield, dc=local")
For each objUser in objOU
If objUser.class="user" then
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ~~~~~ Enable/disable users ~~~~~
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
objUser.Put "userAccountControl", intAccValue
objUser.SetInfo
End if
next
' End
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~