Thanks @Avaryan and @Wayne-Workman. What you’ve mentioned about Fog running scripts as the System user and it not running for all users is correct. I’m going to have to go about what I wanted to do a different way but there was no issue with Fog or anything, thanks again.
Posts made by Oasis
-
RE: Trouble executing PowerShell script through Fog
-
Trouble executing PowerShell script through Fog
Hi all,
We are running Fog version 1.4.4. Not sure if this is the right forum, but I am currently having trouble getting a PowerShell script to run on a Windows 10 machine through Fog. Here is the script, it’s something I want to run after Fog images the machine as it gets rid of packages we don’t want our users having access to (these packages are installed automatically after sysprep).
Get-AppxPackage windowsalarms | Remove-AppxPackage
Get-AppxPackage windowscommunicationsapps | Remove-AppxPackage
Get-AppxPackage officehub | Remove-AppxPackage
Get-AppxPackage skypeapp | Remove-AppxPackage
Get-AppxPackage solitairecollection | Remove-AppxPackage
Get-AppxPackage zunevideo | Remove-AppxPackage
Get-AppxPackage onenote | Remove-AppxPackage
Get-AppxPackage soundrecorder | Remove-AppxPackage
Get-AppxPackage bingweather | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage
Get-AppxPackage zunemusic | Remove-AppxPackage
Get-AppxPackage people | Remove-AppxPackageThe snapin command is:
powershell.exe -ExecutionPolicy Bypass -NoProfile -File Windows10Uninstall.ps1
If I send the ps1 file to PowerShell locally on the client, it runs fine, but when I run it through Fog nothing happens… I get the message through the fog client that it runs, but still nothing. I added “>> C:\log.txt” to all of the commands in the ps1 file and it just creates an empty file.
Any help would be appreciated, thanks.