Page 1 of 1 1
Topic Options
#186681 - 2008-04-03 12:59 PM Service Account Amendments
DJYeo Offline
Fresh Scripter

Registered: 2008-04-03
Posts: 5
I need a script to query all the services on a server and amend any that are running under a specific domain account. We are about to rename the NETBIOS name on our domain from ‘X’ to ‘Y’. I need to amend the domain from ‘X’ to ‘Y’ of the service account but not the username as this is already set correctly.

Any Ideas????

Top
#186686 - 2008-04-03 02:28 PM Re: Service Account Amendments [Re: DJYeo]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Can't test right now but my guess is that the fnWMIService() UDF will do what you want.

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=84031
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186687 - 2008-04-03 03:49 PM Re: Service Account Amendments [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
You can also try this one which also uses WMI but requires a bit less coding on your part to set up and query.

You can use
 Code:
$aServices = WMISvcMgr('list')

to get a list of services, then enumerate each service to find the ones to change
 Code:
; define a new array, but only set what needs to change - the userID/password
Dim $aNewSvcData[9]
$aNewSvcData[8] = 'NewDomain\NewAccount'
$aNewSvcData[9] = 'NewPassword'
; Enumerate the array of services
For Each $Service in $Services
  $aSvcData = WMISvcMgr('query', $Service)
  ; If the service account contains the old user ID, update it
  If InStr($aSvcData[8], 'OldUserID')
    $ = WMISvcMgr('query', $Service, $aNewSvcData)
    ; Don't forget to check for errors!
  EndIF
Next

Glenn

PS - the latest version of this UDF is on the resources section of my web site. I don't think it changed, though. I never found time to implement the Create function.
_________________________
Actually I am a Rocket Scientist! \:D

Top
#186693 - 2008-04-03 05:29 PM Re: Service Account Amendments [Re: Glenn Barnas]
DJYeo Offline
Fresh Scripter

Registered: 2008-04-03
Posts: 5
MAny thanks for the above but unfortunatley its well beyond my KIX knowledge, all is need is the below: -

Old Service Account - Domain01\SQLServer.svc

to change to

New Service Account - Domain02\SQLServer.svc

The password can remain the same, just need to query all srvices and amend the domain part.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.057 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org