[THIN] Re: Serrvice ID Report Tool

  • From: "Chris Lynch" <lynch00@xxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Mon, 30 Jun 2003 09:27:51 -0700

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok.  Then use the following code:

 ' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE";)
strDNSDomain = objRootDSE.Get("DefaultNamingContext")

'Start the ADO connection
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection

'Set the ADO connection query strings
strBase = "<LDAP://"; & strDNSDomain & ">"
strFilter = "(&(objectCategory=computer))"
strAttributes = "distinguishedName,objectCategory,name"

'Create the Query
strQuery = strBase & ";" & strFilter & ";" & strAttributes &
";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

'Look through until the OU is found
While Not objRecordset.EOF
 
        strComputer = objRecordset.Fields("name")
        Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set colServiceList = objWMIService.ExecQuery _
            ("Select * from Win32_Service")
        For Each objservice in colServiceList
    
            'Check to see if the service uses the local NETSVC account
            If objService.Startname = ".\netsvc" Then
        
                'If so, then we need to change the password
                errReturn = objService.Change( , , , , , , , "password") 
                If errReturn <> 0 Then
                        MsgBox errReturn
                End If
            End If 
        Next
Wend

Save the above code into a VBS file.  You will need to change the
line what looks for the ".\netsvc" account to the account you are
looking for.

Let me know if you run into problems.

Chris


- -----Original Message-----
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On
Behalf Of Turman, David C.
Sent: Monday, June 30, 2003 9:18 AM
To: 'thin@xxxxxxxxxxxxx'


        Running AD

- -----Original Message-----
From: Chris Lynch [mailto:lynch00@xxxxxxx]
Sent: Monday, June 30, 2003 11:14 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Serrvice ID Report Tool


 
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Damn it.  Why did the code get stripped.

Here's the code again.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
    ("Select * from Win32_Service")
For Each objservice in colServiceList
    
    'Check to see if the service uses the local NETSVC account
    If objService.Startname = ".\netsvc" Then

          'If so, then we need to change the password
        errReturn = objService.Change( , , , , , , , "password")  
    End If 
Next

What directory service are you running (NT4, AD, etc.)?

Chris 


- - -----Original Message-----
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Chris Lynch
Sent: Monday, June 30, 2003 9:10 AM
To: thin@xxxxxxxxxxxxx

 
- - -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use WMI to do this.


________________________________

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Turman, David C.
Sent: Monday, June 30, 2003 8:57 AM
To: thin@xxxxxxxxxxxxx




        Because of a licensing disagreement with Bindview, we currently
don't have a good reporting tool. 
        I have been using Dump ACL with good success, but need a particular
reoprt. We recently 
        let go a DBA, and have to and change some passwords. One of them is
the password that starts 
        of some services. Does anyone know a good, free utility that will
let me run a report against 
        the network and tell me every server which is usiing a particualr ID
to start a service? 


- - -----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
Comment: Public PGP key for Chris Lynch

iQA/AwUBPwBg5m9fg+xq5T3MEQLe2gCgrzSRIOms5xQMKEjHOLdq5s1DK7cAoOYX
Bz5zqzFZFKahGATr9nuw+ohR
=NTko
- - -----END PGP SIGNATURE-----

- -----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
Comment: Public PGP key for Chris Lynch

iQA/AwUBPwBhsW9fg+xq5T3MEQLZRACfWfOYOUURy6nsmFiUeTj3gUW84wsAoPpR
XUpB4YD5aT/SJCj3khEiHmD0
=/PsO
- -----END PGP SIGNATURE-----

********************************************************
This weeks sponsor - RTOSoft TScale 
Complaints about applications response time - DO SOMETHING ABOUT IT! TScale
2.0 improves applications response time and increases terminal server
capacity. Really get MORE from your existing servers! Free eval:
http://www.rtosoft.com/enter.asp?id=130
**********************************************************
Useful Thin Client Computing Links are available at:
http://thethin.net/links.cfm

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm

********************************************************
This weeks sponsor - RTOSoft TScale 
Complaints about applications response time - DO SOMETHING ABOUT IT!
TScale 2.0 improves applications response time and increases terminal
server capacity. Really get MORE from your existing servers! Free eval:
http://www.rtosoft.com/enter.asp?id=130
**********************************************************
Useful Thin Client Computing Links are available at:
http://thethin.net/links.cfm

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
Comment: Public PGP key for Chris Lynch

iQA/AwUBPwBlBm9fg+xq5T3MEQLWAgCguKWnktYlv3ZcgdWJSwQNwgWamY4An1BI
6xVyIRrW11spKJ+XGMRnW5eX
=7dZp
-----END PGP SIGNATURE-----

********************************************************
This weeks sponsor - RTOSoft TScale 
Complaints about applications response time - DO SOMETHING ABOUT IT!
TScale 2.0 improves applications response time and increases terminal
server capacity. Really get MORE from your existing servers! Free eval:
http://www.rtosoft.com/enter.asp?id=130
**********************************************************
Useful Thin Client Computing Links are available at:
http://thethin.net/links.cfm

For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thethin.net/citrixlist.cfm

Other related posts: