Re: Help with Objet required



Richard Mueller [MVP] comentaba el 19/05/2008:
Juanjillo wrote:


I have this script in example1.vbs:

Dim objshell, objnetwotk
Set objshell = WScript.CreateObject("Wscript.Shell")
Set objnetwork = WScript.CreateObject("Wscript.Network")


Dim vdom, vuser
Set vdom = objnetwork.UserDomain
Set vuser = objnetwork.UserName
wscript.echo "Welcome to the domain: " & vdom & ", " & vuser & "."

when i execute this command with csript example1.vbs y have this response.
Object is requied [string: "Mydomainname"]


Don't use "set" when you assign values to the string variables. Use:

vdom = objnetwork.UserDomain
Set vuser = objnetwork.UserName

Only use "Set" to assign object references, like objNetwork.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net

Thanks a lot
I´m newbie wit this :D

--
Agures


.



Relevant Pages

  • Re: Help with Objet required
    ... Dim vdom, vuser ... Set vuser = objnetwork.UserName ... Only use "Set" to assign object references, like objNetwork. ... MVP Directory Services ...
    (microsoft.public.scripting.wsh)
  • Re: Help with Objet required
    ... Dim objshell, objnetwotk ... Dim vdom, vuser ... Only use "Set" to assign object references, like objNetwork. ...
    (microsoft.public.scripting.wsh)
  • Re: Help with Objet required
    ... Dim vdom, vuser ... Set vuser = objnetwork.UserName ... Only use "Set" to assign object references, like objNetwork. ... You can also learn from the scripts in the Technet Script Center: ...
    (microsoft.public.scripting.wsh)

Loading