Re: Help with Objet required



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


.



Relevant Pages

  • Re: Help with Objet required
    ... Dim objshell, objnetwotk ... Dim vdom, vuser ... Set vuser = objnetwork.UserName ... Only use "Set" to assign object references, like objNetwork. ...
    (microsoft.public.scripting.wsh)
  • Re: Help with Objet required
    ... I like JScript more then VBScript (only "var" is present) ... Dim vdom, vuser ... scripting for administration of AD networks I recommend "Microsoft Windows 2000 Scripting Guide". ...
    (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. ... MVP Directory Services ...
    (microsoft.public.scripting.wsh)