Announcement

Collapse
No announcement yet.

Deploy Powershell script?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deploy Powershell script?

    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?



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

  • #2
    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 AUTHORITY\SYSTEM, 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.
    *RicklesP*
    MSCA (2003/XP), Security+, CCNA

    ** Remember: credit where credit is due, and reputation points as appropriate **

    Comment

    Working...
    X