.vbsスクリプトの実行中に権限の問題が発生しています。スクリプトは、受付側のコンピュータから新しいユーザーアカウントを追加することです。.vbsスクリプトのアクセス許可 - 80070005
スクリプトがライン上にハングアップを取得します:
objUser.SetInfo
それが実際に属性を設定し、ユーザーアカウントに書き込みを行っているところです。
私はそれが許可の問題であることを知っています。私はアクセス許可が問題ではないはずの "トップレベル"の管理者としてスクリプトを実行しようとしましたが、まだエラー80070005
が表示されます。ドメインコントローラーやワークステーションから実行しても差はありません - 同じエラーです。
単純な3行のスクリプトを作成して私の理論をテストするユーザーオブジェクトを作成しました。さらに、3行目のスクリプトもobjUser.SetInfo
行で失敗します。
このスクリプトをドメインに参加したコンピュータ(管理アシスタントまたは受付)から簡単に実行するにはどうすればよいですか? (実際0x8007
ある)
strOU= InputBox("Enter the classification of the new User" &_
vbCrLf & "NOTE: You MUST enter 'Patients'")
If strOU = False Then Call NO_OU(1)
If strOU = "" Then Call NO_OU(2)
' If IsNumeric(strOU) = False Then Call NO_OU(3)
strName = InputBox("Enter the Logon ID of the New Patient (firstname.lastname)" &_
vbCrLf & "to be created.")
If strName = False Then Call NOName(1)
If strName = "" Then Call NOName(2)
' If IsNumeric((Left(strName,3))) = False Then Call NOName(3)
strFirstName = InputBox("Enter the New Patient's First Name")
If strFirstName = False Then Call NOName(1)
If strFirstName = "" Then Call NOName(2)
strLastName = InputBox("Enter the New Patients's Last Name")
If strLastName = False Then Call NOName(1)
If strLastName = "" Then Call NOName(2)
strtelephoneNumber = InputBox("Enter the New Patients's Telephone")
If strLastName = False Then Call NOName(1)
If strLastName = "" Then Call NOName(2)
strstreetAddress = InputBox("Enter the New Patients's Street Address")
If strLastName = False Then Call NOName(1)
If strLastName = "" Then Call NOName(2)
strl = InputBox("Enter the New Patients's city")
If strLastName = False Then Call NOName(1)
If strLastName = "" Then Call NOName(2)
strpostalCode = InputBox("Enter the New Patients's postal code")
If strLastName = False Then Call NOName(1)
If strLastName = "" Then Call NOName(2)
Call Password()
Call Main()
Call Quit(2)
Sub Main()
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
Set objRoot = GetObject("LDAP://rootDSE")
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objDomain = GetObject("LDAP://" &_
objRoot.Get("defaultNamingContext"))
Set objOU = GetObject("LDAP://OU=" &_
strOU & "," & strDNSDomain)
'Create the new User
On Error Resume Next
Set objUser = objOU.Create("User", "cn=" & strFirstName & " " & strLastName)
objUser.Put "sAMAccountName", strName
objUser.Put "givenName", strFirstName
objUser.Put "sn", strLastName
objUser.Put "distinguishedName", strFirstName & " " & strLastName
objUser.Put "displayName", strLastName & "," & strFirstName
objUser.Put "userPrincipalName", strName & "@dicksonmedical.mittens.local"
objuser.Put "telephoneNumber", strtelephoneNumber
objuser.Put "streetAddress", strstreetAddress
objuser.Put "l", strl
objuser.Put "postalCode", strpostalCode
objUser.SetInfo
If Err.number <> 0 Then Call Quit(1)
'Set User account environment
Set objUser = objOU.GetObject ("User", "cn=" & strFirstName & " " & strLastName)
Const Enabled = 1
Const Disabled = 0
If objUser.class = "user" Then
objUser.AllowLogon = Enabled
objUser.IsAccountLocked = False
objUser.SetPassword strInputReturn1
objUser.Put "pwdLastSet", Disabled
objUser.AccountDisabled = False
objUser.SetInfo
End if
'objUser.SetPassword StrPassword1
'objUser.SetPassword StrPassword2
'objUser.Put "pwdLastSet", Enabled
End Sub
Function Password()
strPassword = InputBox("Enter the User's Password")
If strPassword = False Then Call NOPassword(1)
If strPassword = "" Then Call NOPassword(2)
strConfPassword = InputBox("Enter the User's Password")
If strConfPassword = False Then Call NOPassword(1)
If strConfPassword = "" Then Call NOPassword(2)
If strPassword <> strConfPassword Then
Call PasswordMisMatch(1)
Else strInputReturn1 = strPassword
End If
End Function
Sub NO_OU(Error)
If Error = "1" Then MsgBox("Canceled")
If Error = "2" Then MsgBox("Invalid User Type Entered!" &_
vbCrLf & "Enter 'Patients'")
If Error = "3" Then MsgBox("Invalid User Type Entered!" &_
vbCrLf & "Enter 'Patients'")
Call Quit(1)
End sub
Sub NOName(Error)
If Error = "1" Then MsgBox("Canceled")
If Error = "2" Then MsgBox("User's Name not entered.")
If Error = "3" Then MsgBox("Invalid User Name" & vbCrLf &_
"Example: 888$jsmith")
Call Quit(1)
End sub
Sub NOPassword(Error)
If Error = "1" Then MsgBox("Canceled")
If Error = "2" Then MsgBox("User's Password not entered.")
Call Quit(1)
End Sub
Sub PasswordMisMatch(Error)
If Error = "1" Then MsgBox("Passwords Do NOT Match" &_
vbCrLf & "Try Again.")
Call Password()
End Sub
Sub Quit(Error1)
If Error1 = "1" Then MsgBox("Script Canceled!!")
If Error1 = "2" Then MsgBox("User Account Created.")
WScript.Quit
End Sub
Sub Sure(Error1)
If Error = "1" Then strYN = MsgBox("Are you sure?", 4, "Enter OU Prompt")
If strYN = 6 Then
If strYN = 7 Then Call Quit(1)
End If
End Sub
3ライナーの方は、私たちにお見せしましょうか?そして正確なエラー? – mailq
オペレーティングシステム? – Bryan
オペレーティングシステムは2008年サーバー –