Having an issue with a deployment.
Deploying an application. Scenario as follows:
It runs whether or not the user is logged in.
I am logged out of the computer, no one is logged in.
Let it run and it fails.
I log into the computer and I know it at least partially ran because I can track the last thing it did successfully which was copy a file to the machine but it stops there and doesn’t continue.
The next step is to create a HKLM key using
Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\Unregister Filesite’ -Name ‘ComponentID’ -Value ‘Unregister Software’ -Type String -ContinueOnError $True
That reg key doesn’t get created.
I would say that is the problem but if I am logged into the computer and run the deployment from Software Center, the deployment runs fine. It also runs fine if I go through and run the steps in the PS1 manually.
It also isn’t creating a log in c:\windows\logs\software so I can’t get anymore info
It seems that the SCCM/MECM application is using user permissions. This might explain everything.
It says it is installing for System, whether or not there is something in the script though, I am not sure but it gets through several steps where it uninstalls things and copies files to the ProgramData folder which would require admin rights. Then it gets to the one step where it is to create a HKLM key and it doesn’t do it. Not sure why it isn’t writing a log though, that would definitely be helpful. the XML file shows that the log is set to write to the correct location. It’s hard in this instance because it only fails when not logged in so I’m unable to monitor it. If it would be helpful to post the whole scrip then I can.
It says it is using the System account. I just tried as a package instead and still received the same error.
I still think it’s an SCCM issue or an account permission issue. Try to launch a simple script with SCCM that creates a file in the
c:\windows\logs\software folder. I bet it fails.
Other things that install/uninstall using psadt will write logs to that location. If I run the deployment while logged in it will uninstall old software and psadt will write the old msi uninstall log in that same location.
Try recreating the SCCM App.
It doesn’t make sense that some PSADT scripts give you a log file and this one doesn’t.
Something is different in this script or SCCM App.
Maybe even comment-out some lines to see it you get a log file or not.
Just recreated the app and still the same thing. Commenting out the steps that it fails on.
If I run from Software Center while logged in it will complete just fine but still doesn’t write a log file.
You could try this someplace to see under what account deployapplication.ps1 running as but I can’t help you beyond this:
"Current User is [$ProcessNTAccount]" > "$env:temp\PSADT.log"
So I would just append that to the actual command in the script and it will log that info or do I put it anywhere in the script and it’ll log that?
anywhere after it loads AppDeployToolkitMain.ps1