Script issue

Peter_1985 2,666 Reputation points
2022-02-03T14:07:31.387+00:00

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.SetInfo

WScript.Quit

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
981 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,895 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 117.1K Reputation points
    2022-02-03T14:21:06.667+00:00

    Try removing the ' from ' Bind and ' Build and retype it using a regular single quotation mark (apostrophe).


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.