在NT移植期间改变用户帐户的属性0

句容历史解密网 2020-08-11 04:47:40

在NT移植期间改变用户帐户的属性

在把用户从NT的备份域控制器向Windows 2000移植的过程中,我们需要改变用户的资料档案的路径。这个脚本是由其它的代码的片断以及一些巧妙的方法综合而成的。这使得修改其它用户的属性变得相当容易。

===================================================

' Name: s

' Description: Modify profile path of user accounts.

Only those with a current roaming profile are udpated.

' Original: 13 Jun 05

'

'=================================================

Set objConnection = CreateObject("nnection")

en "Provider=ADsDSOObject;"

Set objCommand = CreateObject("mand") tiveConnection = objConnection

iteLine "Enter search criteria.

Wildcards can be used."

strUserName = adLine

ho

mandText = _

"LDAP://dc=,dc=;"

_ "((objectCategory=user)(sAMAccountName=" strUserName "));" _

"sAMAccountName,profilePath,ADsPath;subtree"

Set objRecordSet = ecute

If F Then

ho "No user account(s) found with the specified criteria."

Else

ho "User account(s) with the specified criteria:"

While Not F

ho elds("sAMAccountName") " : " _

elds("profilePath")

veNext

WEnd

End If

ho

strNewProfPath = ""

While strNewProfPath = ""

iteLine "Enter new profile server and share: "

StrNewProfPath = adLine WEnd ho

' Refresh record set to apply new path.

Set objRecordSet = ecute

While Not F

If IsNull(elds("profilePath")) Then

ho elds("sAMAccountName") " has no roaming profile."

ho

Else

strADsPath = elds("ADsPath")

Set objUser = GetObject(strADsPath)

t "profilePath", strNewProfPath "" _

elds("sAMAccountName") ".USR"

tInfo

End If

veNext

WEnd

' Refresh record set to view new profile path.

Set objRecordSet = ecute

ho "User account(s) with the new target data:"

While Not F

'ho elds("profilePath")

If elds("profilePath") " " Then

ho elds("sAMAccountName") " : " _

elds("profilePath")

End If

veNext

WEnd

ose

医药健康资讯
济源好的白癜风医院
胃炎
友情链接