[THIN] Re: OT: VBScript/WSH/WMI question.

  • From: "Nail, Larry" <lnail@xxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Fri, 15 Nov 2002 10:39:24 -0600

Neil,

A computer account is just a user account with a $ appended to it.  I use
&H2000 to detect Domain Controllers when I remove inactive computer accounts
on my domains.  I check for this b/c DC's don't change their account
passwords.

Here is an exerpt from my script...
        Const DCUF = &H2000

        For Each oComp In objDomain
            Set oNTComp = GetObject("WinNT://" & strDomain & "/" &
oComp.Name & "$")

        'Test to see if the computer is a DC, skip it if true
            If (oNTComp.UserFlags And USERFLAG) Then
          Wscript.echo oNTComp.Name & " -- " &
CInt(oNTComp.PasswordAge/intAgeCtr) & " Days old" & " -- DC Account
excluded"

Now I did chase this down a bit more & unfortunately I can not find a
differentiation between PDC & BDC.. 
-----Original Message-----
From: Braebaum, Neil [mailto:neil.braebaum@xxxxxxxxxxxxxxxxxxxxxxxx] 
Sent: Friday, November 15, 2002 10:08 AM
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] Re: OT: VBScript/WSH/WMI question.



Larry - userflags are not relevant for computer objects - which if you look
at the code, is what Chris is filtering on.

Presumably they are accessible, when actually opening the *user* account
object for the computer in the same - but that's not what's being accessed /
filtered here.

There's probably precious little available through the WinNT provider to
differentiate.

The only thing I can imagine as being problematic with the original script,
being either some networky, resource, or permissions problems with the
security context actually running the script.

Chris - just out of interest, why do you assign the name of the computer
object to a variable,  then on the very next line output the object name?
The assignment just seems redundant, 'cos you don't seem to use it.

Your comment about having a script prepared using the ADSI provider (I
assume you actually meant LDAP), for when you've got AD - note for the
foreseeable, your use of the WinNT provider will quite happily work, and be
useful even when using native-mode AD.

You only *need* to switch to using the LDAP provider, when you need access
to properties only available through that provider, or to use some other
aspect of this method of access, or perhaps to use more sophisticated
selection or search criteria.

Neil

> -----Original Message-----
> From: Nail, Larry [mailto:lnail@xxxxxx]
> Sent: 15 November 2002 15:50
> To: 'thin@xxxxxxxxxxxxx'
> Subject: [THIN] Re: OT: VBScript/WSH/WMI question.
> 
> Chris,
> 
> Off the top of my head... In ADSI, a Domain Controller has a
> USERFLAGS entry
> of &H2000.    You should be able to chase down an attribute 
> of the computer
> object in a domain that would tell you it it's the PDC.
> 
> -----Original Message-----
> From: Chris Lynch [mailto:lynch00@xxxxxxx]
> Sent: Thursday, November 14, 2002 6:00 PM
> To: TheThin. net
> Subject: [THIN] OT: VBScript/WSH/WMI question.
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have created a script (along with another engineer) to
> gather useful = information in a specific domain.  It will 
> scan for all "computer" = objects, and query some WMI stuff 
> from them.  BUT, I cannot get the = script to "find" the PDC. 
>  It "finds" and queries the BDC in the domain just fine. If I 
> specify the PDC servers name in the  = script, the script 
> will connect to WMI and query the information we = need.  I 
> don't want to have to enter in the server name for every time 
> = we run this script.
> 
> Below, you will find a sample of how we "find"
> computer/server objects = using the WINNT provider.  We are 
> not running AD, but are planning the = migration.  We already 
> have another script for the ADSI provider.
> 
> - ---------------------------------------------------------------
> Option explicit
>   Dim oContainer, oComputer1, oNetwork
>   Dim sDomainName, sComputer
>   Set oNetwork =3D WScript.CreateObject("WScript.Network")
>   sDomainName =3D oNetwork.UserDomain
> 
>   Set oContainer =3D GetObject("WinNT://" & sDomainName)
>   oContainer.Filter =3D Array("computer")
>   For Each oComputer1 in oContainer
>     sComputer =3D oComputer1.Name
>     Wscript.Echo oComputer1.Name
>   Next
> 
> MsgBox "DONE."
> - ---------------------------------------------------------------

***********************************************************************
This e-mail and its attachments are intended for the above named 
recipient(s) only and are confidential and may be privileged. If they have
come to you in error you must take no action based 
on them, nor must you copy or disclose them or any part of 
their contents to any person or organisation; please notify the 
sender immediately and delete this e-mail and its attachments from 
your computer system.

Please note that Internet communications are not necessarily secure 
and may be changed, intercepted or corrupted. We advise that 
you understand and observe this lack of security when e-mailing us 
and we will not accept any liability for any such changes, 
interceptions or corruptions. 

Although we have taken steps to ensure that this e-mail and its 
attachments are free from any virus, we advise that in keeping 
with good computing practice the recipient should ensure they 
are actually virus free.

Copyright in this e-mail and attachments created by us belongs 
to Littlewoods. 

Littlewoods takes steps to prohibit the transmission of offensive, 
obscene or discriminatory material.  If this message contains 
inappropriate material please forward the e-mail intact to 
postmaster@xxxxxxxxxxxxxxxxx and it will be investigated. 
Statements and opinions contained in this e-mail may not 
necessarily represent those of Littlewoods.

Please note that e-mail communication may be monitored.

Registered office: 
Littlewoods Retail Limited, 
Sir John Moores Building, 
100 Old Hall Street, 
Liverpool,
L70 1AB 
Registered no: 421258  

http://www.littlewoods.com 
***********************************************************************

*********************************************** 
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm

*********************************************** 
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm

Other related posts: