A new Flexera Community experience is coming on November 18th, click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

custom action in vbs creates admin user

CChong
By Level 11 Flexeran
Level 11 Flexeran
I have worked on this for 2 days. I am creating a LOCAL admin user so that they can run our upgrade process. I created the msi in Wise however it does not uninstall (gives error 1101). I wanted to use the company standard which is installshield.
All that the package does is copy down a vbs file and then executes it, since it is a Deferred execution and the policies are set to always run msi in elevated privileges it should work as it does in Wise. The vbscript:

'Determing computer name
Set objNet=CreateObject("wscript.Network")
strComputer=objNet.ComputerName
'Defining "password never expires" constant
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
'creating user
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = colAccounts.Create("user","tempaccount")
objUser.SetPassword "password12"
objUser.SetInfo
Set objUser = Nothing
'putting "password never expires" flag
Set objUser = GetObject("WinNT://" & strComputer & "/tempaccount,user")
objUserFlags = objUser.Get("UserFlags")
objPasswordExpirationFlag = objUserFlags OR ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag
objUser.SetInfo
Set objUser = Nothing
'Adding user tempaccount to administartors group
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/tempaccount,user")
objGroup.Add(objUser.ADsPath)


Any replys greatly appreaciated!!

Al..
(2) Replies
If i remeber correctly (which i sometimes don't) custom actions of VBScript don't always launch with admin rights from within an MSI.

I.E the MSI has Admin rights but the custom action does not. Test it by installing somewhere using an Admin account.

What type of Action is it?
CChong
By Level 11 Flexeran
Level 11 Flexeran
Thanks for your insight into this. I finished this lask week and as far as I know as long as the .msi is runs in elevated context all the this msi spawns is run in the same context. I finally got iy to work consistanly.