Try removing the '
from ' Bind
and ' Build
and retype it using a regular single quotation mark (apostrophe).
Script issue
Hi,
How to resolve
Y:\L0\Feb>cscript S1.vbs
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.Y:\L0\Feb\S1.vbs(6, 1) Microsoft VBScript compilation error: Invalid character
with this?
Option Explicit
Dim strUser
Dim objRootLDAP, objContainer, objNewUser
strUser = "User0"‘ Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & _
objRootLDAP.Get("defaultNamingContext"))‘ Build the actual User.
Set objNewUser = objContainer.Create("User", "cn=" & strUser)
objNewUser.Put "sAMAccountName", strUser
objNewUser.SetInfoWScript.Quit
-
Viorel 117.1K Reputation points
2022-02-03T14:21:06.667+00:00