Script - Win10Setup - V

The other day I found that my Script was not correctly getting the application names from the Apps to remove list so I corrected that issue in a newer version of my script. I have also added the ability to disable OneDrive and Cortana in the script

Full resource files can be found HERE

The original script is HERE

Removes built in windows apps and imports a start menu layout.

The script will look to the AppsToRemove.txt file for a list of apps to uninstalls from the curent user profile 
and will prevent the apps installing for all new user profiles. The script will also import a xml file for a 
start menu default lay out for all new user logins. You can also remove OneDrive and Cortana with this script.

Specifyes the list of apps to be removed defaults to AppsToRemove.txt 

.PARAMETER StartMenuLayout
Specifyes the xml file for the start menu layout

.PARAMETER DisableOneDrive
Disables OneDrive on the computer

.PARAMETER DisableCortana
Disables Cortana on the computer

.\Win10Setup.ps1 -Apps AppsList.txt
Removes all apps in the AppsList.txt file

.\Win10Setup.ps1 -StartMenuLayout StartMenuLayout.xml
Imports the xml file to use as the default start menu layout for all new users
To build your xml run Export-StartLayout -Path "C:\example\StartMenuLayout.xml"

.\Win10Setup.ps1 -StartMenuLayout StartMenuLayout.xml -Apps AppsToRemove.txt -DisableOneDrive -DisableCortana
Imports the start menu config removes apps listed in the txt file disbales one drive and cortana.

Created By: Kris Gross
Twitter: @kmgamd

You can get updates to this script and others from here


#If a list file is specifyed will run the uninstall process
IF ($Apps)
    #Removes some windows apps
    $AppsList = Get-Content $Apps
    Foreach ($App in ($AppsList))
            $item = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -Like "*$App*"}
            Write-Host "Removing $App"
            Remove-AppxProvisionedPackage -Online -PackageName $item.PackageName
            Get-AppxPackage -AllUsers | Where-Object Name -Like "*$App*" | Remove-AppxPackage

#If a config file is specifed will import it 
IF ($StartMenuLayout)
    #Configures the start menu layout
    Write-Host importing $StartMenuLayout
    #Copyies a IE Shortcut to the all users start menu so all users will have it the start menu config
    # Copy-Item -Path "Internet Explorer.lnk" -Destination "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"
    Import-StartLayout -LayoutPath $StartMenuLayout -MountPath C:\

If ($DisableOneDrive)
    Write-Host 'Disabling OneDrive'
    $RegPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive"
    $Name = "DisableFileSyncNGSC"
    $Value = "1"
    $Type = "DWORD"

    Set-Location HKLM:
    if (!(test-Path .\SOFTWARE\Policies\Microsoft\Windows\OneDrive)) {New-Item .\SOFTWARE\Policies\Microsoft\Windows\OneDrive}
    New-ItemProperty -Path $RegPath -Name $Name -Value $Value -PropertyType $Type -Force | Out-Null
    Set-Location $PSScriptRoot

If ($DisableCortana)
    Write-Host "Disabling Cortana"
    $RegPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
    $Name = "AllowCortana"
    $Value = "0"
    $Type = "DWORD"

    Set-Location HKLM:
    if (!(test-Path .\SOFTWARE\Policies\Microsoft\Windows\"Windows Search")) {New-Item .\SOFTWARE\Policies\Microsoft\Windows\"Windows Search"}
    New-ItemProperty -Path $RegPath -Name $Name -Value $Value -PropertyType $Type -Force | Out-Null
    Set-Location $PSScriptRoot

Popular Posts

Office 365 Deployment - Office 365 Upgrade Task Sequence

SCCM Task Sequence with GUI - How to install more then one image with a single Task Sequence

Windows 10 Setup Script - V