0

I have a PowerShell script to install an MSI that I have successfully created which works when running at the computer. I have then taken the script and ran it inside a script block using invoke-command and as well using enter-pssession and both ways it succeeds but it will not register the software with the main program it works with (configuration.xml file should be updated but is not). All PowerShell and command-line sessions are run with elevated network admin creds as we make use of UAC. The installation files contain a registration tool(exe) which I can run successfully (with code) from both PowerShell and command line locally and it updates the configuration.xml. Once I run the registration tool remotely (invoke-command, enter-pssession, psexec) it all runs and does not return an error but it does not work (does not update configuration.xml).

I have logged the installs and no issues and even viewer shows successfull installs every time.

There is something about running in a remote session that is messing with the registration and cannot figure it out.

Here is some more info to better show what I have done

Software Installs = Program installs
Software Registers = ClientSettings.xml file is updated

MSI Installation Code:

Start-Process msiexec.exe -Wait -PassThru -ArgumentList '/I "C:\Installs\SOFTWARE\Files\SOFTWARE.msi" ALLUSERS="1" COUNTRY=OP ALLOWWEBUPDATES=0 ALLOWREMOTESERVICES=0 STANDALONE=No INSTALLCOUNSELING=No ADDLOCAL=Media,Common,Algorithm,ProgramFiles,CompactSQL2005,FlexNetConnect,FusePlatform,LanguageIndependent,RatataskPlatform,SpecSaversOnly /quiet'
#(software installs, software registers)

Run the above remotely:

invoke-command -computername MYPC -scriptblock {Start-Process msiexec.exe -Wait -PassThru -ArgumentList '/I "C:\Installs\SOFTWARE\Files\SOFTWARE.msi" ALLUSERS="1" COUNTRY=OP ALLOWWEBUPDATES=0 ALLOWREMOTESERVICES=0 STANDALONE=No INSTALLCOUNSELING=No ADDLOCAL=Media,Common,Algorithm,ProgramFiles,CompactSQL2005,FlexNetConnect,FusePlatform,LanguageIndependent,RatataskPlatform,SpecSaversOnly /quiet' }
#(software installs, software does not register) I found the failure is the registration.exe tool

Run the registration tool locally:

start-process -NoNewWindow -FilePath 'C:\Installs\Software\Files\program files\Software\Noah4RegistrationTool.exe' -ArgumentList '/R /P "C:\Program Files (x86)\Software\Software.exe" /L "C:\Program Files (x86)\Software\Software\Logo.dll" /I 3 /M 35 /N "Software 1.5"'
#(software registers)

Run the registration tool remotely:

invoke-command -computername MYPC -scriptblock {start-process -NoNewWindow -FilePath 'C:\Installs\Software\Files\program files\Software\Noah4RegistrationTool.exe' -ArgumentList '/R /P "C:\Program Files (x86)\Software\Software.exe" /L "C:\Program Files (x86)\Software\Software\Logo.dll" /I 3 /M 35 /N "Software 1.5"'}
#(software doesn't register) No errors are produced and event viewer shows no errors

Run remotely using enter-pssession:

enter-pssession
start-process -NoNewWindow -FilePath 'C:\Installs\Software\Files\program files\Software\Noah4RegistrationTool.exe' -ArgumentList '/R /P "C:\Program Files (x86)\Software\Software.exe" /L "C:\Program Files (x86)\Software\Software\Logo.dll" /I 3 /M 35 /N "Software 1.5"'
#(software doesn't register) No errors are produced and event viewer shows no errors

Register using PSEXEC:

cmd /c '"C:\Installs\Software\Files\program files\Software\Noah4RegistrationTool.exe" /R  /P "C:\Program Files (x86)\Software\Software.exe" /L "C:\Program Files (x86)\Software\Software\Logo.dll" /I 3 /M 35 /N "Software 1.5"'
#(software doesn't register)
hcm
  • 922
  • 3
  • 10
  • 1
    You'll probably need to post some code for us to identifiy where the problem might be. – hcm Dec 24 '19 at 10:43
  • please add the code to your question, not into the comments. – hcm Dec 25 '19 at 15:47
  • You will have to determine if it is the UAC which is stopping you or the tool itself. If you are able to test the installation on a client where UAC is deactivated, this could be worth a shot. Also https://stackoverflow.com/questions/7690994/running-a-command-as-administrator-using-powershell might help. How did you check if the registration tool threw any errors when running it remotely via `invoke-command`? Would you be so good as to delete your now obsolete comments? ;-) Thanks. – hcm Dec 26 '19 at 13:16
  • I didn't check with invoke-command to see errors since I switched to Enter-Pssession and that gives me an interactive session yet didn't throw errors. MyPC is in a protected OU and has UAC disabled already. It would seem odd that the msi works and returns "0" and only the registration piece doesn't work if it were UAC. I just ran the registration using enter-pssession on another machine which I just turned UAC off on and still no go – L3prichaun13 Dec 26 '19 at 17:00
  • What does the registration tool return? You can check that with `$lastexticode`. Maybe you have the possibilty to write a log with that tool? If that does not provide any useful information I fear I'm out of ideas because without debugging information we can only guess. – hcm Dec 27 '19 at 08:41
  • Lastexitcode returns nothing. I assigned the script to a variable ($result) and used -pasdthru which got me more details. $result.exitcode returned "1" – L3prichaun13 Dec 27 '19 at 11:26
  • and what does the documentation of the tool say to this error code... – hcm Dec 27 '19 at 12:10
  • Nothing. The tool was not meant to be used as a separate thing. I dug deep to find all this stuff. The MSI is what handles everything... accept when run remotely. I think im going to have to register on one machine and take that Registration info and ensure each machine I remote install to has that info and inject it into the xml file if not... less than ideal but hey, gotta make do with what you got. Thank you for all your time and efforts – L3prichaun13 Dec 27 '19 at 16:46

0 Answers0