WMI Custom Action Problem.
Hi Guy's,
Does anyone know why this vbscript doesn't run when executed inside a MSI?
===CODE===
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'SgeClient'",,48)
For each objService in colItems
errServiceChange = objService.Change( , , , , , 0)
errServiceChange = objService.Change( , , , , , , "DOMAIN\ServiceAccount","")
errServiceChange = objService.Change( , , , , , , ,"password")
errServiceState = objService.StopService()
errServiceState = objService.StartService()
next
===END CODE===
Thanks,
Dwayne.
Does anyone know why this vbscript doesn't run when executed inside a MSI?
===CODE===
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'SgeClient'",,48)
For each objService in colItems
errServiceChange = objService.Change( , , , , , 0)
errServiceChange = objService.Change( , , , , , , "DOMAIN\ServiceAccount","")
errServiceChange = objService.Change( , , , , , , ,"password")
errServiceState = objService.StopService()
errServiceState = objService.StartService()
next
===END CODE===
Thanks,
Dwayne.
0 Comments
[ + ] Show comments
Answers (10)
Please log in to answer
Posted by:
jmcfadyen
16 years ago
you need to ensure that the impersonation level you are using is relevant to the context with which you deploy the CA.
One would assume you have this CA as a deferred CA after the files have been deployed.
You also need to consider the context which your deployment tool will deploy these apps.
For example if the deployment tool is "domain admin" then the CA should run as User context as this during installation would be the "domain admin" account.
alternatively you could use the local system account however this would not have access back to network resources. So there is a number of things which should be considered and you haven't detailed any that you currently used for this script.
more detail would be useful for more accurate answers.
One would assume you have this CA as a deferred CA after the files have been deployed.
You also need to consider the context which your deployment tool will deploy these apps.
For example if the deployment tool is "domain admin" then the CA should run as User context as this during installation would be the "domain admin" account.
alternatively you could use the local system account however this would not have access back to network resources. So there is a number of things which should be considered and you haven't detailed any that you currently used for this script.
more detail would be useful for more accurate answers.
Posted by:
runtorious
16 years ago
Hey,
So far I haven't been able to get the CA to run if I install the package manually as a Domain Admin, or if I deploy it using Active Directory which uses the computer\system account. If I execute the script manually as a Domain Admin then it works, so I'm assuming that it's something MSI specific that is preventing this from running.
Dwayne.
So far I haven't been able to get the CA to run if I install the package manually as a Domain Admin, or if I deploy it using Active Directory which uses the computer\system account. If I execute the script manually as a Domain Admin then it works, so I'm assuming that it's something MSI specific that is preventing this from running.
Dwayne.
Posted by:
AngelD
16 years ago
Posted by:
runtorious
16 years ago
Hey,
I have these actions in the InstallExecuteSequence table near the end of the sequence. Because the service I need to modify isn't installed through the ServiceInstall table, and I don't have the source, I have to force a reboot before I can modify the new service. This is the sequence I'm using:
Action:Condition:Sequence
ForceReboot:AFTERRREBOOT <> 1:6551
SetServiceAccount::6552
SetServiceRights::6553
InstallFinalize::6600
The SetServiceAccount is the script that is supposed to be changing the service account, and the service rights script is supposed to change the local privilages of that account. Right now neither of them are running, as a type 6 or type 1030 custom action. I turned on Windows Installer Logging and I am getting error 1503, stating that the user account that was installing the package has changed and then the installation fails:
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding Privileged property. Its value is '1'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding USERNAME property. Its value is 'user'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding COMPANYNAME property. Its value is 'Valley First '.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding Installed property. Its value is '2006/09/22 16:11:06'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding DATABASE property. Its value is 'C:\WINDOWS\Installer\fd40.msi'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding OriginalDatabase property. Its value is 'C:\WINDOWS\Installer\fd40.msi'.
MSI (s) (14:24) [13:14:17:111]: Note: 1: 2262 2: PatchPackage 3: -2147287038
MSI (s) (14:24) [13:14:17:111]: Machine policy value 'DisableRollback' is 0
MSI (s) (14:24) [13:14:17:111]: User policy value 'DisableRollback' is 0
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding UILevel property. Its value is '2'.
=== Logging started: 8/13/2007 13:14:17 ===
MSI (s) (14:24) [13:14:17:493]: Checking in-progress install: install performed by different user.
MSI (s) (14:24) [13:14:17:493]: Checking in-progress install: install for same configuration.
MSI (s) (14:24) [13:14:17:493]: Note: 1: 1503 2: SYSTEM 3: SafeGuard® Easy Client 4.30.0
User 'SYSTEM' has previously initiated an install for product 'SafeGuard® Easy Client 4.30.0 '. That user will need to run that install again before they can use that product.
MSI (s) (14:24) [13:14:17:570]: Note: 1: 1729
MSI (s) (14:24) [13:14:18:074]: Product: SafeGuard® Easy Client 4.30.0 -- Configuration failed.
Thanks,
Dwayne.
I have these actions in the InstallExecuteSequence table near the end of the sequence. Because the service I need to modify isn't installed through the ServiceInstall table, and I don't have the source, I have to force a reboot before I can modify the new service. This is the sequence I'm using:
Action:Condition:Sequence
ForceReboot:AFTERRREBOOT <> 1:6551
SetServiceAccount::6552
SetServiceRights::6553
InstallFinalize::6600
The SetServiceAccount is the script that is supposed to be changing the service account, and the service rights script is supposed to change the local privilages of that account. Right now neither of them are running, as a type 6 or type 1030 custom action. I turned on Windows Installer Logging and I am getting error 1503, stating that the user account that was installing the package has changed and then the installation fails:
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding Privileged property. Its value is '1'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding USERNAME property. Its value is 'user'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding COMPANYNAME property. Its value is 'Valley First '.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding Installed property. Its value is '2006/09/22 16:11:06'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding DATABASE property. Its value is 'C:\WINDOWS\Installer\fd40.msi'.
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding OriginalDatabase property. Its value is 'C:\WINDOWS\Installer\fd40.msi'.
MSI (s) (14:24) [13:14:17:111]: Note: 1: 2262 2: PatchPackage 3: -2147287038
MSI (s) (14:24) [13:14:17:111]: Machine policy value 'DisableRollback' is 0
MSI (s) (14:24) [13:14:17:111]: User policy value 'DisableRollback' is 0
MSI (s) (14:24) [13:14:17:111]: PROPERTY CHANGE: Adding UILevel property. Its value is '2'.
=== Logging started: 8/13/2007 13:14:17 ===
MSI (s) (14:24) [13:14:17:493]: Checking in-progress install: install performed by different user.
MSI (s) (14:24) [13:14:17:493]: Checking in-progress install: install for same configuration.
MSI (s) (14:24) [13:14:17:493]: Note: 1: 1503 2: SYSTEM 3: SafeGuard® Easy Client 4.30.0
User 'SYSTEM' has previously initiated an install for product 'SafeGuard® Easy Client 4.30.0 '. That user will need to run that install again before they can use that product.
MSI (s) (14:24) [13:14:17:570]: Note: 1: 1729
MSI (s) (14:24) [13:14:18:074]: Product: SafeGuard® Easy Client 4.30.0 -- Configuration failed.
Thanks,
Dwayne.
Posted by:
AngelD
16 years ago
Seems that the previous version was installed through Active Directory as stated by Note: 1: 1503 2: SYSTEM 3: SafeGuard® Easy Client 4.30.0 User 'SYSTEM' has previously initiated an install for product 'SafeGuard® Easy Client 4.30.0 '. That user will need to run that install again before they can use that product..
Was the previous version installed as per-user or per-machine?
Have you placed the CA in Deffered sequence?
Was the previous version installed as per-user or per-machine?
Have you placed the CA in Deffered sequence?
Posted by:
runtorious
16 years ago
Posted by:
AngelD
16 years ago
Posted by:
runtorious
16 years ago
Posted by:
runtorious
16 years ago
Posted by:
jmcfadyen
16 years ago
you mentioned you are using a custom tool to install the service.
which OS are you on ?
I would recommend using the new SC command to install the service. This allows the service to be installed using the correct account context detail etc.
SC allows full configuration of service details including context / start stop settings / automatic manual blah blah you get the idea im sure. This would mean it can all be done without the reboot.
Its available on XP up I believe. Its definately on 2k3 servers you may need to check for XP.
which OS are you on ?
I would recommend using the new SC command to install the service. This allows the service to be installed using the correct account context detail etc.
SC allows full configuration of service details including context / start stop settings / automatic manual blah blah you get the idea im sure. This would mean it can all be done without the reboot.
Its available on XP up I believe. Its definately on 2k3 servers you may need to check for XP.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.