Scripts/New-WindowsInstall.ps1


cd\


# Rename-Computer -NewName "" #-Restart
# Add-Computer -DomainName test.local -OUPath "OU=Servers, OU=Klant, DC=test, DC=local"


# Enable ping
Get-NetFirewallRule -DisplayGroup 'Core Networking Diagnostics' | Enable-NetFirewallRule

Set-TimeZone "W. Europe Standard Time"




#############################################
# PowerShell #
#############################################

if (!(Test-Path $PROFILE)) {

    $ProfileContents = "cd\"

    New-Item (Split-Path $PROFILE) -Type Directory -ErrorAction 0
    New-Item $PROFILE -Type file -Value $ProfileContents -ErrorAction 0

}


Install-PackageProvider -Name NuGet -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

Install-Module packagemanagement -Force
Install-Module JaapsTools


#############################################
# Windows settings #
#############################################

#Set DPI 100
Start-BitsTransfer -Source "https://github.com/imniko/SetDPI/releases/download/v0.2/SetDpi.exe" -Destination $([Environment]::GetFolderPath("CommonApplicationData"))
C:\ProgramData\SetDpi.exe 100
C:\ProgramData\SetDpi.exe 1 100


UserAccountControlSettings.exe
mmsys.cpl


# Disable Autoplay
Write-Host "Disabling Autoplay..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1

# Disable Autorun for all drives
Write-Host "Disabling Autorun for all drives..."
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
    New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255

# Disable Sticky keys prompt
Write-Host "Disabling Sticky keys prompt..."
Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "506"


# Unpin Store from Taskbar

if ((Test-Path -LiteralPath "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer") -ne $true) {
    New-Item "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Force -ea SilentlyContinue
}
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer' -Name "NoPinningStoreToTaskbar" -Value 1 -PropertyType DWord -Force -ea SilentlyContinue
New-ItemProperty "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "DisableSearchBoxSuggestions" -PropertyType DWORD -Value 1 -Force | Out-Null


# Hide Search button / box
Write-Host "Hiding Search Box / Button..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
# Taskbar combining
New-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarGlomLevel -PropertyType DWORD -Value 2 -Force
# Tray icons
New-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name EnableAutoTray -PropertyType DWORD -Value 0 -Force
# Explorer settings
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name Hidden -Value 1
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name HideFileExt -Value 0
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name LaunchTo -Value 1
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name ShowSuperHidden -Value 0
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Ribbon" -Name MinimizedStateTabletModeOff -Value 0
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name MultiTaskingAltTabFilter -Value 3 -Force | Out-Null
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarMn -Value 0 -Force | Out-Null
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarDa -Value 0 -Force | Out-Null

New-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "AppsUseLightTheme" -Value 0 -PropertyType DWORD -Force
New-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "SystemUsesLightTheme" -Value 0 -PropertyType DWORD -Force
New-ItemProperty "HKCU:\Software\Microsoft\Windows\DWM" -Name "ColorPrevalence" -Value 1 -PropertyType DWORD -Force

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 0

New-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name DontUsePowerShellOnWinx -PropertyType DWORD -Value 0 -Force

if ((Test-Path -LiteralPath "HKCU:\Control Panel\Desktop") -ne $true) {
    New-Item "HKCU:\Control Panel\Desktop" -Force -ea SilentlyContinue
}
if ((Test-Path -LiteralPath "HKCU:\Control Panel\Colors") -ne $true) {
    New-Item "HKCU:\Control Panel\Colors" -Force -ea SilentlyContinue
}
New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Desktop' -Name 'WallPaper' -Value '' -PropertyType String -Force -ea SilentlyContinue
New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Colors' -Name 'Background' -Value '20 20 20' -PropertyType String -Force -ea SilentlyContinue

if (Get-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds" -Name "ShellFeedsTaskbarViewMode" -ea 0) {
    Get-Process explorer | Stop-Process; New-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds' -Name "ShellFeedsTaskbarViewMode" -Value 2 -PropertyType DWORD -Force
}

$WindowsEdition = (Get-WindowsEdition -Online).Edition
if ($WindowsEdition -like "*server*") {
    New-ItemProperty -Path HKCU:Software\Microsoft\ServerManager -Name DoNotOpenServerManagerAtLogon -PropertyType DWORD -Value "0x1" -Force

    # IE ESC mode disabled
    # $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
    # $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
    # Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force
    # Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force

    # Multiple TS sessions per user
    New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name fSingleSessionPerUser -Value 0 -PropertyType REG_DWORD -Force
}



# No sounds

New-ItemProperty -Path HKCU:\AppEvents\Schemes -Name "(Default)" -Value ".None" -Force | Out-Null
Get-ChildItem -Path "HKCU:\AppEvents\Schemes\Apps" | Get-ChildItem | Get-ChildItem | Where-Object { $_.PSChildName -eq ".Current" } | Set-ItemProperty -Name "(Default)" -Value ""


# Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation\ -Name DisableStartupSound -Value 1 # Check if works properly
Set-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name DisableStartupSound -Value 1




#############################################
# Edge settings #
#############################################


if ((Test-Path -LiteralPath "HKCU:\SOFTWARE\Policies\Microsoft\Edge") -ne $true) {
    New-Item "HKCU:\SOFTWARE\Policies\Microsoft\Edge" -Force -ea SilentlyContinue | Out-Null
}
if ((Test-Path -LiteralPath "HKCU:\SOFTWARE\Policies\Microsoft\Edge\Recommended") -ne $true) {
    New-Item "HKCU:\SOFTWARE\Policies\Microsoft\Edge\Recommended" -Force -ea SilentlyContinue | Out-Null
}
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'HideRestoreDialogEnabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'NewTabPageManagedQuickLinks' -Value '[ { "url": "https://outlook.office.com", "title": "Outlook", "pinned": false } ]' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'HideFirstRunExperience' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'SmartScreenPuaEnabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'NewTabPageSearchBox' -Value 'redirect' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'ForceSync' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'EdgeShoppingAssistantEnabled' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'ShowMicrosoftRewards' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'ShowRecommendationsEnabled' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'NewTabPageContentEnabled' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'NewTabPageAllowedBackgroundTypes' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'NewTabPageHideDefaultTopSites' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'MicrosoftEdgeInsiderPromotionEnabled' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
# New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'BlockThirdPartyCookies' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
# New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'BrowserSignin' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'ConfigureOnlineTextToSpeech' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'PromotionalTabsEnabled' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'DefaultNotificationsSetting' -Value 2 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'DefaultSearchProviderEnabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'DefaultSearchProviderImageURL' -Value '{google:baseURL}searchbyimage/upload' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'DefaultSearchProviderName' -Value 'Google' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'DefaultSearchProviderSearchURL' -Value '{google:baseURL}search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}ie={inputEncoding}' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'DefaultSearchProviderSuggestURL' -Value '{google:baseURL}complete/search?output=chrome&q={searchTerms}' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'SmartScreenEnabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge' -Name 'HubsSidebarEnabled' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge\Recommended' -Name 'ControlDefaultStateOfAllowExtensionFromOtherStoresSettingEnabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Policies\Microsoft\Edge\Recommended' -Name 'FavoritesBarEnabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
if ((Test-Path -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls") -ne $true) {
    New-Item "HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls" -Force -ea SilentlyContinue | Out-Null
}
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls' -Name '1' -Value '[*.]microsoft.com' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls' -Name '2' -Value '[*.]microsoftonline.com' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls' -Name '3' -Value '[*.]teams.skype.com' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls' -Name '4' -Value '[*.]teams.microsoft.com' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls' -Name '5' -Value '[*.]sfbassets.com' -PropertyType String -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Edge\CookiesAllowedForUrls' -Name '6' -Value '[*.]skypeforbusiness.com' -PropertyType String -Force -ea SilentlyContinue | Out-Null


#############################################
# Office settings #
#############################################

New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\Calendar' -Name 'WeekNum' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\Reminders' -Name 'PlaySound' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Message' -Name 'DisableReadingPaneCompose' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'EnableSingleLineRibbon' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'PlaySound' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'ShowEnvelope' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'NewmailDesktopAlerts' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'PreviewMarkMessage' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'PreviewWaitSeconds' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'PreviewDontMarkUntilChange' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'ReadingPaneSelectItem' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'DensitySetting' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'ShowBcc' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences' -Name 'ShowAutoSug' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Word\Options' -Name 'PasteFormattingWithin' -Value 2 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Word\Options' -Name 'PasteFormattingTwoDocumentsNoStyles' -Value 2 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Word\Options' -Name 'PasteFormattingOtherApp' -Value 2 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Word\Options' -Name 'PasteFormattingTwoDocumentsWithStyles' -Value 2 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null


#############################################
# Chromium settings #
#############################################


New-Item "HKCU:\Software\Policies\Chromium\Recommended" -Force | Out-Null
New-Item "HKCU:\Software\Policies\Chromium\ClearBrowsingDataOnExitList" -Force | Out-Null

$JSON = @"
[
    {
        "toplevel_name": "Microsoft"
    },
    {
        "name": "Entra",
        "url": "https://entra.microsoft.com/"
    },
    {
        "name": "Intune",
        "url": "https://Intune.microsoft.com/"
    },
    {
        "name": "Azure",
        "url": "https://portal.azure.com/"
    },
    {
        "name": "MS 365 Home",
        "url": "https://portal.office.com/"
    },
    {
        "name": "MS 365 Admin",
        "url": "https://admin.microsoft.com/"
    },
    {
        "name": "Exchange Admin",
        "url": "https://admin.exchange.microsoft.com/"
    },
    {
        "name": "Device login",
        "url": "https://microsoft.com/devicelogin/"
    },
    {
        "name": "Security",
        "url": "https://security.microsoft.com/"
    },
    {
        "name": "AVD",
        "url": "https://client.wvd.microsoft.com/arm/webclient/"
    },
    {
        "name": "My Account",
        "url": "https://myaccount.microsoft.com/"
    },
    {
        "name": "My Apps",
        "url": "https://myapps.microsoft.com/"
    },
    {
        "name": "PowerBI Admin",
        "url": "https://app.powerbi.com/admin-portal"
    },
    {
        "name": "PowerAutomate",
        "url": "https://make.powerautomate.com/"
    },
    {
        "name": "PowerPlatform Admin",
        "url": "https://admin.powerplatform.microsoft.com/"
    }
]
"@


New-ItemProperty HKCU:\Software\Policies\Chromium -Name ManagedBookmarks -Value $JSON -Force | Out-Null
New-ItemProperty HKCU:\Software\Policies\Chromium\Recommended -Name BookmarkBarEnabled -Value 1 -Force | Out-Null
New-ItemProperty HKCU:\Software\Policies\Chromium -Name TranslateEnabled -Value 0 -Force | Out-Null
New-ItemProperty HKCU:\Software\Policies\Chromium -Name DefaultNotificationsSetting -Value 2 -Force | Out-Null
New-ItemProperty HKCU:\Software\Policies\Chromium -Name DefaultBrowserSettingEnabled -Value 0 -Force | Out-Null
New-ItemProperty HKCU:\Software\Policies\Chromium\ClearBrowsingDataOnExitList -Name 1 -Value "cached_images_and_files" -Force | Out-Null



#############################################
# 7-zip settings #
#############################################


if ((Test-Path -LiteralPath "HKCU:\SOFTWARE\7-Zip\Options") -ne $true) {
    New-Item "HKCU:\SOFTWARE\7-Zip\Options" -Force -ea SilentlyContinue | Out-Null
}
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\7-Zip\Options' -Name 'CascadedMenu' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\7-Zip\Options' -Name 'ContextMenu' -Value 4391 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null
New-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\7-Zip\Options' -Name 'MenuIcons' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue | Out-Null




#############################################
# Git folder #
#############################################


$PSModulePaths = $env:PSModulePath -split ";"
$GitFolder = Join-Path $($env:USERPROFILE) "Git"

New-Item $GitFolder -ItemType Directory -Force -ea 0


Write-Verbose ($PSModulePaths | Out-String) -Verbose


if ($PSModulePaths -contains $GitFolder) {
    Write-Warning "$GitFolder is already added to the PSModulePath variable"
} else {

    $key = (Get-Item 'HKCU:\').OpenSubKey('Environment', $true)
    $path = $key.GetValue('PSModulePath', '', 'DoNotExpandEnvironmentNames')
    if ($path) {
        $path += ';'
    }
    $path += '%USERPROFILE%\Git'
    Write-Verbose $path -Verbose

    $key.SetValue('PSModulePath', $path, [Microsoft.Win32.RegistryValueKind]::ExpandString)

}




#############################################
# Chocolatey #
#############################################


# Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))


# winget install Chocolatey.Chocolatey --accept-package-agreements --accept-source-agreements

choco feature enable -n allowGlobalConfirmation



#############################################
# Uninstall Apps #
#############################################

Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Getstarted" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage
Get-AppxPackage "Microsoft.People" | Remove-AppxPackage
Get-AppxPackage "Microsoft.SkypeApp" | Remove-AppxPackage
Get-AppxPackage "microsoft.windowscommunicationsapps" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsMaps" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsFeedbackHub" | Remove-AppxPackage
Get-AppxPackage "Microsoft.GetHelp" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftStickyNotes" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage
Get-AppxPackage "MicrosoftTeams" | Remove-AppxPackage
Get-AppxPackage "MicrosoftWindows.Client.WebExperience" | Remove-AppxPackage
Get-AppxPackage "Microsoft.549981C3F5F10" | Remove-AppxPackage



# Install

choco install 7zip
choco install notepadplusplus.install
choco install treesizefree

choco install pwsh

choco install vscode
code --install-extension ms-vscode.powershell

choco install vlc

choco install bandlab-assistant --ignore-checksums
choco install nvidia-display-driver
choco install Shotcut
choco install steam
choco pin add --name='steam'
choco install spotify
choco pin add --name='spotify'
choco install asio4all
# choco install microsoft-edge

choco install signal
choco pin add --name='signal'

choco install office365business --params='/exclude:"Publisher Outlook Access Lync"'
choco pin add --name='Office365Business'

# choco install forticlientvpn

# choco install powertoys
# choco install epicgameslauncher
# choco pin add --name='epicgameslauncher'



# OneDrive Always available offline

# attrib.exe +P "$([Environment]::GetFolderPath("MyDocuments"))\WindowsPowerShell\*" /D /S

Set-OnedriveItemAvailability Offline "$([Environment]::GetFolderPath("MyDocuments"))"





#############################################
# Windows 11 #
#############################################


# ExplorerPatch (Win11)
# Invoke-WebRequest "https://github.com/valinet/ExplorerPatcher/releases/latest/download/ep_setup.exe" -OutFile $env:TEMP\ep_setup.exe
# Start-Process $env:TEMP\ep_setup.exe

# Classic context menu
New-Item "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Force -Value ""







Invoke-WebRequest "christitus.com/win" | Invoke-Expression




# 14X1134 ## Don't use
# winget search clevo
# winget install 9N6WG0G8B041 --accept-package-agreements --accept-source-agreements
# winget install 9P6LJMR12RN1 --accept-package-agreements --accept-source-agreements
# winget install 9NHG85RQCZN0 --accept-package-agreements --accept-source-agreements
# winget install 9PMKHPLDZ6VL --accept-package-agreements --accept-source-agreements
# winget install 9P1V7SKXG6H5 --accept-package-agreements --accept-source-agreements
winget uninstall 9N6WG0G8B041
winget uninstall 9P6LJMR12RN1
winget uninstall 9NHG85RQCZN0
winget uninstall 9PMKHPLDZ6VL
winget uninstall 9P1V7SKXG6H5



#############################################
# Windows Activation #
#############################################

#
# https://gist.github.com/mokoshalb/b87326bbb62805e94da72f8d0f73f563
# https://docs.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys
#
# https://softwarekeep.com/help-center/upgrade-windows-10-home-to-pro-using-an-upgrade-key-and-slmgr
#


Set-Location \windows\system32

cscript .\slmgr.vbs /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43              # W10 Enterprise
cscript .\slmgr.vbs /skms kms.digiboy.ir:1688
cscript .\slmgr.vbs /ato

# https://github.com/massgravel/Microsoft-Activation-Scripts/
Invoke-RestMethod https://massgrave.dev/get | Invoke-Expression