newpersn Posted August 31, 2016 Posted August 31, 2016 (edited) I've created a login script to run when users login and its not running. When i put the script in Powershell i get this error.. PS Microsoft.PowerShell.Core\FileSystem::\\..\c$\Users\..\Desktop> \\..\c$\Users\..\Desktop\removeapps3.ps1 File \\..\c$\Users\...\Desktop\removeapps3.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. + CategoryInfo : SecurityError: ( [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnauthorizedAccess Any help? (.. = Computer and username) Edited August 31, 2016 by newpersn
DJ-1701 Posted August 31, 2016 Posted August 31, 2016 I've created a login script to run when users login and its not running. When i put the script in Powershell i get this error.. Any help? (.. = Computer and username) At the command line, try running the script like this to see what the actual issue is... powershell.exe -ExecutionPolicy Bypass -File The policy should be bypassed by default when running powershell login scripts, so I believe this is giving you a different error when running as yourself.
newpersn Posted August 31, 2016 Author Posted August 31, 2016 At the command line, try running the script like this to see what the actual issue is... powershell.exe -ExecutionPolicy Bypass -File The policy should be bypassed by default when running powershell login scripts, so I believe this is giving you a different error when running as yourself. Still get it to work when i add it to a Logon Script :\ I'll post the code here.. BAT File calling the PS1 file powershell.exe -ExecutionPolicy Bypass -File removeapps3.ps1 My script here (removeapps3.ps1) Get-AppxPackage -name “Microsoft.ZuneMusic” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.Music.Preview” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.XboxGameCallableUI” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.XboxIdentityProvider” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingTravel” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingHealthAndFitness” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingFoodAndDrink” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.People” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingFinance” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.3DBuilder” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.WindowsCalculator” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingNews” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.XboxApp” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingSports” | Remove-AppxPackage Get-AppxPackage -name "Microsoft.Messaging" | Remove-AppxPackage Get-AppxPackage -name "Microsoft.MicrosoftStickyNotes" | Remove-AppxPackage Get-AppxPackage -name “Microsoft.WindowsCamera” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.Getstarted” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.Office.OneNote” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.WindowsMaps” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.MicrosoftSolitaireCollection” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.MicrosoftOfficeHub” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BingWeather” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.BioEnrollment” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.WindowsStore” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.Windows.Photos” | Remove-AppxPackage Get-AppxPackage -name “Microsoft.WindowsPhone” | Remove-AppxPackage
MrKJLS Posted August 31, 2016 Posted August 31, 2016 What happens if you write the output of the script to a text file, does it show you anything? out-file C:\test.txt Or i think that's how you do it https://technet.microsoft.com/en-us/library/ee176924.aspx
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now