Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WSH Script 1

Status
Not open for further replies.

IAMINFO

MIS
Feb 21, 2002
62
US
Thank you for taking time to read this.
In my example below when I run this, the asset number for computer name MIS554419 is returned. I constantly am changing the computer name to query for information I am seeking. I desperatley need help with a input statement that will take the pc name that is plugged and return the data.

Thank You!


Set objUser= GetObject("LDAP://CN=MIS554419,CN=Computers,DC=Bank,DC=phila,DC=gov")
strAssetnumber = objUser.Get("assetNumber")
Wscript.Echo "PropertyTag:" &strAssetnumber
 
try this

Dim Input
Input = InputBox("Enter your name")
MsgBox ("You entered: " & Input)
 
Something like this ?
Code:
Do
  PC=Trim(InputBox("Enter PC name"))
  If Len(PC)=0 Then Exit Do
  Set objUser=GetObject("LDAP://CN=" & PC & _
   ",CN=Computers,DC=Bank,DC=phila,DC=gov")
  strAssetnumber=objUser.Get("assetNumber")
  WScript.Echo PC & " PropertyTag:" & strAssetnumber
Loop

Hope This Help
PH.
 
Thank you for replying, If I might impose PHV, for some reason the script will no longer accept the Set statement in line 4. The error message is
Line 4
Char 3
Error: A referral was returned from the server
Code 8007202B
Source (null)

Thanks again! for your help
 
Generally, this error is returned when DC is mispelled.
I realize that before the
Code:
 Loop
line we have to release the object like this:
Code:
Set objUser=Nothing

Hope This Help
PH.
 
Greetings all:

I really would appreciate help here.
I am trying to pass the value of input1 to my ldap statement

"LDAP://cn=input1
However my syntax is not correct, would someone please tell
me what I am doing wrong. Thank you so much for reading this.

Do

Input1=InputBox("Enter the users account name with the underscore")
If Len(Input1) = 0 Then Exit Do

Input2=InputBox("Enter the users First and Last Name")
If Len(Input2) = 0 Then Exit Do


MsgBox ("The user account is: "& Input1)
MsgBox ("The users Active Directory Display name is: "& Input2)


Set objOU = GetObject("LDAP://cn=users,dc=penna,dc=phila,dc=gov")

objOU.MoveHere _
"LDAP://cn=input1,cn=users,dc=penna,dc=phila,dc=gov", "cn=" & input2

Loop


 
Like this ?
objOU.MoveHere _
"LDAP://cn=" & input1 & ",cn=users,dc=penna,dc=phila,dc=gov", "cn=" & input2


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top