Hi,
thank you for the tip, the msgBox is working well.
Please note that "USERNAME" is not a public property of the installer, it is an environment variable. To reference an environment variable you should also use '%' before its name as in my example.
I specified this property in the Advance Installer (User specified property) and I can access this as [USERNAME] in the AI. Will it be an environment variable in this case?
Unfortunately either does not work with '%' and without '%'
I'm not a VB expert, I copy my code. I see during the installation the sUsername and sPassword are empty strings. If I specify a constant string as sUserName the script is working well.
Code: Select all
public Sub changeUser()
Dim sUserName
Dim sPassword
sUserName = Session.Property("%SERVICE_USER")
sPassword = Session.Property("%SERVICE_PASSWORD")
MsgBox "UserName: " & sUserName
Set oWMIService = GetObject("winmgmts:")
'Retrieve all services
Set cServices = oWMIService.ExecQuery _
("Select * from Win32_Service")
'Examine each service one at a time
For Each oService in cServices
If oService.Name = "JChemWebServices" Then
errServiceChange = oService.Change( , , , , , , sUserName , sPassword)
End If
Next
End Sub
Thank you. Edvard
FOLLOW US
Get the latest news in Application Packaging