Deploy Powershell script?

Home Forums Scripting PowerShell Deploy Powershell script?

This topic contains 1 reply, has 2 voices, and was last updated by Avatar Anonymous 2 years, 12 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Avatar
    jason0923
    Participant
    #166649

    Our Windows 10 machines the logins can take up to 2 minutes. I’ve found that if I run the below commands to remove some of the built in apps the logins are significantly faster. My question is is there any way of deploying this to many computers. I’ve tried it as a Group Policy both startup and login script it doesn’t run. We have too many machines for me to go to each open powershell as admin etc. Is there a goo way of deploying something like this?

    [TABLE]
    [TR]
    [TD]# Description:[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]# This script removes unwanted Apps that come with Windows. If you do not want[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]# to remove certain Apps comment out the corresponding lines below.[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]Import-Module -DisableNameChecking $PSScriptRoot..libtake-own.psm1[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]echo “Elevating priviledges for this process”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]do {} until (Elevate-Privileges SeTakeOwnershipPrivilege)[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]echo “Uninstalling default apps”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]$apps = @([/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]# default Windows 10 apps[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.3DBuilder”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.Appconnector”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingFinance”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingNews”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingSports”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingWeather”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.FreshPaint”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.Getstarted”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.MicrosoftOfficeHub”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.MicrosoftSolitaireCollection”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.MicrosoftStickyNotes”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.Office.OneNote”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.OneConnect”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.People”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.SkypeApp”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.Windows.Photos”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.WindowsAlarms”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.WindowsCalculator”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.WindowsCamera”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.WindowsMaps”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.WindowsPhone”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.WindowsSoundRecorder”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.WindowsStore”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.XboxApp”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.ZuneMusic”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.ZuneVideo”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”microsoft.windowscommunicationsapps”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.MinecraftUWP”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]# Threshold 2 apps[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.CommsPhone”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.ConnectivityStore”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.Messaging”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.Office.Sway”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#Redstone apps[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingFoodAndDrink”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingTravel”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.BingHealthAndFitness”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Microsoft.WindowsReadingList”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]# non-Microsoft[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”9E2F88E3.Twitter”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”PandoraMediaInc.29680B314EFC2″[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Flipboard.Flipboard”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”ShazamEntertainmentLtd.Shazam”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”king.com.CandyCrushSaga”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”king.com.CandyCrushSodaSaga”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”king.com.*”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”ClearChannelRadioDigital.iHeartRadio”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”4DF9E0F8.Netflix”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”6Wunderkinder.Wunderlist”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”Drawboard.DrawboardPDF”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”2FE3CB00.PicsArt-PhotoStudio”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”D52A8D61.FarmVille2CountryEscape”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”TuneIn.TuneInRadio”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]”GAMELOFTSA.Asphalt8Airborne”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”TheNewYorkTimes.NYTCrossword”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]# apps which cannot be removed using Remove-AppxPackage[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.BioEnrollment”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.MicrosoftEdge”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.Windows.Cortana”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.WindowsFeedback”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.XboxGameCallableUI”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Microsoft.XboxIdentityProvider”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]#”Windows.ContactSupport”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD])[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]foreach ($app in $apps) {[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]echo “Trying to remove $app”[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD] [/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]Get-AppXProvisionedPackage -Online |[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]where DisplayName -EQ $app |[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]Remove-AppxProvisionedPackage -Online[/TD]
    [/TR]
    [TR]
    [TD] [/TD]
    [TD]}[/TD]
    [/TR]
    [/TABLE]

    Avatar
    Anonymous
    #371969

    This should work as a startup script, but deploying thru GP will fail, if you’re trying to run it under a domain account. That’s due to a recent MS update, and how network creds are stored in the ‘sysvol’ share where policies are read from, and all users have read access to. If you create a scheduled task to run this at startup, and have it run as NT AUTHORITYSYSTEM, and deploy it thru GPP, it will deploy. Be sure and set the policy to apply once only. If you need it to run under a domain service account or some such, then after the policy is deployed, use a script to change the creds to the domain account you want. That second change can be run as a manual PS script under your domain admin creds, scanning each domain PC one at a time. Read up on the “Get-ScheduledTask” and related commands to verify the task is registered on the PC & change the creds.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.