Error below:

C:\scripts\lcompbydom.vbs(104, 2) Microsoft VBScript runtime error: Object
required: 'DOMAIN1'

Here is what I'm trying to do.
1. Read in file with entries including valid domain names. Each line has 1
entry.

DOMAIN1
DOMAIN2
DOMAIN3

2. Each line is read and added to the array.
3. Then I want to find each computer in each domain which is an entry in the
array.
4. Get the error on the first entry.

Here is the section with the lines referenced in the message

'Open INPUT file for reading selected domains

Set objFSO = CreateObject("Scripting.FileSystemObject")
strInFullName = objFSO.BuildPath(strInPath, strDataInFileName)
Set objInputFile = objFSO.OpenTextFile (strInFullName, FOR_READING)

Do Until objInputFile.AtEndOfStream
Redim Preserve arrDataInput(Index)
arrDataInput(Index) = objInputFile.Readline
Index = Index + 1
Loop

objInputfile.Close
' The next line is #104
For DataItem = LBound(arrDataInput) to UBound(arrDataInput) Step 1
objDomain = arrDataInput(DataItem)
Set objUseDomain = GetObject("WinNT://" & objDomain.Name)
objUseDomain.Filter = Array("Computer")
ParseComputers
Next

Thanks!

Re: Runtime error by Richard

Richard
Thu Apr 29 12:19:56 CDT 2004

Hi,

The error is actually raised two lines after the one you indicate. The line
is:

Set objUseDomain = GetObject("WinNT://" & objDomain.Name)

The reason for the error is that objDomain is not an object, but a string,
such as "DOMAIN1". The statement should be:

Set objUserDomain = GetObject("WinNT://" & objDomain)

--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.rlmueller.net
--
"redbandana" <redbandana@earthlink.net> wrote in message
news:u66PkUfLEHA.3216@TK2MSFTNGP12.phx.gbl...
> Error below:
>
> C:\scripts\lcompbydom.vbs(104, 2) Microsoft VBScript runtime error: Object
> required: 'DOMAIN1'
>
> Here is what I'm trying to do.
> 1. Read in file with entries including valid domain names. Each line has 1
> entry.
>
> DOMAIN1
> DOMAIN2
> DOMAIN3
>
> 2. Each line is read and added to the array.
> 3. Then I want to find each computer in each domain which is an entry in
the
> array.
> 4. Get the error on the first entry.
>
> Here is the section with the lines referenced in the message
>
> 'Open INPUT file for reading selected domains
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> strInFullName = objFSO.BuildPath(strInPath, strDataInFileName)
> Set objInputFile = objFSO.OpenTextFile (strInFullName, FOR_READING)
>
> Do Until objInputFile.AtEndOfStream
> Redim Preserve arrDataInput(Index)
> arrDataInput(Index) = objInputFile.Readline
> Index = Index + 1
> Loop
>
> objInputfile.Close
> ' The next line is #104
> For DataItem = LBound(arrDataInput) to UBound(arrDataInput) Step 1
> objDomain = arrDataInput(DataItem)
> Set objUseDomain = GetObject("WinNT://" & objDomain.Name)
> objUseDomain.Filter = Array("Computer")
> ParseComputers
> Next
>
> Thanks!
>
>



Re: Runtime error by redbandana

redbandana
Thu Apr 29 12:42:33 CDT 2004

Thanks! So my older version referenced and object and now I'm feeding in a
string. I get it. Thanks.
{now i will purge the other references} ;>

"Richard Mueller [MVP]" <rlmueller-NOSPAM@ameritech.NOSPAM.net> wrote in
message news:OCnx45gLEHA.3052@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> The error is actually raised two lines after the one you indicate. The
line
> is:
>
> Set objUseDomain = GetObject("WinNT://" & objDomain.Name)
>
> The reason for the error is that objDomain is not an object, but a string,
> such as "DOMAIN1". The statement should be:
>
> Set objUserDomain = GetObject("WinNT://" & objDomain)
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> HilltopLab web site - http://www.rlmueller.net
> --
> "redbandana" <redbandana@earthlink.net> wrote in message
> news:u66PkUfLEHA.3216@TK2MSFTNGP12.phx.gbl...
> > Error below:
> >
> > C:\scripts\lcompbydom.vbs(104, 2) Microsoft VBScript runtime error:
Object
> > required: 'DOMAIN1'
> >
> > Here is what I'm trying to do.
> > 1. Read in file with entries including valid domain names. Each line has
1
> > entry.
> >
> > DOMAIN1
> > DOMAIN2
> > DOMAIN3
> >
> > 2. Each line is read and added to the array.
> > 3. Then I want to find each computer in each domain which is an entry in
> the
> > array.
> > 4. Get the error on the first entry.
> >
> > Here is the section with the lines referenced in the message
> >
> > 'Open INPUT file for reading selected domains
> >
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > strInFullName = objFSO.BuildPath(strInPath, strDataInFileName)
> > Set objInputFile = objFSO.OpenTextFile (strInFullName, FOR_READING)
> >
> > Do Until objInputFile.AtEndOfStream
> > Redim Preserve arrDataInput(Index)
> > arrDataInput(Index) = objInputFile.Readline
> > Index = Index + 1
> > Loop
> >
> > objInputfile.Close
> > ' The next line is #104
> > For DataItem = LBound(arrDataInput) to UBound(arrDataInput) Step 1
> > objDomain = arrDataInput(DataItem)
> > Set objUseDomain = GetObject("WinNT://" & objDomain.Name)
> > objUseDomain.Filter = Array("Computer")
> > ParseComputers
> > Next
> >
> > Thanks!
> >
> >
>
>