Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Set-Reg {
- param (
- [string]$key,
- [string]$name,
- [string]$value,
- [string]$type
- )
- If ((Test-Path -Path $key) -eq $false) {
- New-Item -Path $key -Force
- }
- $k = Get-Item -Path $key
- If ($null -eq $k.GetValue($name)) {
- New-ItemProperty -Path $key -Name $name -Value $value -PropertyType $type
- }
- else {
- Set-ItemProperty -Path $key -Name $name -Value $value
- }
- }
- $Admin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
- If (!$Admin) {
- Write-Host 'Running as non-admin, some settings won''t be applied. Please run this script with Admin privileges to apply system-wide settings.' -ForegroundColor Yellow
- }
- #Set execution policy
- Set-ExecutionPolicy bypass -Scope CurrentUser -Force -Confirm:$false
- #Set Windows Explorer settings
- $key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\'
- Set-Reg -key $key -name 'HideFileExt' -value 0 -type 'DWord'
- Set-Reg -key $key -name 'NavPaneShowAllFolders' -value 1 -type 'DWord'
- Set-Reg -key $key -name 'NavPaneExpandToCurrentFolder' -value 1 -type 'DWord'
- Set-Reg -key $key -name 'Start_NotifyNewApps' -value 0 -type 'DWord'
- Set-Reg -key $key -name 'Start_ShowMyComputer' -value 2 -type 'DWord'
- Set-Reg -key $key -name 'Start_ShowControlPanel' -value 2 -type 'DWord'
- Set-Reg -key $key -name 'Start_ShowRun' -value 1 -type 'DWord'
- Set-Reg -key $key -name 'StartMenuAdminTools' -value 2 -type 'DWord'
- Set-Reg -key $key -name 'DontUsePowerShellOnWinx' -value 0 -type 'DWord'
- #Fix Explorer white on white issue
- $key = 'HKCU:\Software\Microsoft\Windows\DWM'
- Set-Reg -key $key -name 'ColorPrevalence' -value 1 -type 'DWord'
- Set-Reg -key $key -name 'AccentColor' -value D3D3D3 -type 'DWord'
- #Desktop Icons
- $key = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel'
- Set-Reg -key $key -name '{20D04FE0-3AEA-1069-A2D8-08002B30309D}' -value 0 -type 'DWord'
- Set-Reg -key $key -name '{645FF040-5081-101B-9F08-00AA002F954E}' -value 1 -type 'DWord'
- Set-Reg -key $key -name '{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}' -value 0 -type 'DWord'
- Set-Reg -key $key -name '{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}' -value 0 -type 'DWord'
- #Set cmd settings
- $key = 'HKCU:\Console\'
- Set-Reg -key $key -name 'QuickEdit' -value 1 -type 'DWord'
- Set-Reg -key $key -name 'ScreenBufferSize' -value 196608120 -type 'DWord'
- Set-Reg -key $key -name 'WindowSize' -value (65536 * 180 + 40) -type 'DWord'
- #Set IE defaults
- Set-Reg -key 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\' -name 'IEHarden' -value 0 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\' -name 'WarnonZoneCrossing' -value 0 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'IE8TourShown' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'IE8RunOncePerInstallCompleted' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'IE8TourNoShow' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'DisableFirstRunCustomize' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'IE9TourShown' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'IE10TourShown' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'IE11TourShown' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'RunOnceComplete' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'RunOnceHasShown' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'Friendly http errors' -value 'no' -type 'String'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'Check_Associations' -value 'no' -type 'String'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'WarnOnclose' -value 0 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'OpenInForeground' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'Groups' -value 0 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'NewTabNextToCurrent' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'NewTabPageShow' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'ShortcutBehavior' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\TabbedBrowsing\' -name 'ThumbnailBehavior' -value 0 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Internet Explorer\Main\' -name 'start page' -value 'http://www.google.com' -type 'String'
- Set-Reg -key 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\' -name 'ConfirmFileDelete' -value 1 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage\' -name 'OpenAtLogon' -value 0 -type 'DWord'
- Set-Reg -key 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\' -name 'LaunchTo' -value 1 -type 'DWord'
- if ($Admin) {
- #Disable Loopback Check
- Set-Reg -key 'HKLM:\System\CurrentControlSet\Control\Lsa' -name 'DisableLoopbackCheck' -value 1 -type 'Dword'
- #Set Print Spooler to manual startup
- #Set-Service spooler -StartupType Manual
- Stop-Process -processname explorer -confirm:$false -Force
- }
- If ($PSVersionTable.PSVersion.Major -ge 3) {
- New-item -type file -force $profile
- (Invoke-WebRequest 'https://pastebin.com/Q5bPNtZf').Content | Out-File $profile
- } else {
- Try {
- $wc = New-Object System.Net.WebClient
- $wc.DownloadFile('https://pastebin.com/Q5bPNtZf', $profile)
- }
- Catch {
- Write-Host "Could not download https://pastebin.com/Q5bPNtZf, please copy manually" -ForegroundColor Red
- }
- $dlnew = Read-Host "Powershell version is old, download latest? (Will require reboot)"
- if ($dlnew -eq "y") {
- $osver = (Get-WmiObject -Class Win32_OperatingSystem).Caption
- if ($osver -like "*Server 2008 R2*" -or $osver -like "*Windows 7*") {
- Write-Host "$osver detected, redirecting to Powershell 5.1" -ForegroundColor Cyan
- $IE = new-object -com internetexplorer.application
- $IE.navigate2("https://www.microsoft.com/en-us/download/details.aspx?id=54616")
- $IE.visible = $true
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement