├── ForceADReplication.ps1 ├── SendWOLPacket.ps1 ├── SetADUserExpiration.ps1 ├── SetAzureStorageBlobTierToArchive.ps1 ├── Windows10Scrub.ps1 ├── checkFSMORoles.ps1 └── profile.ps1 /ForceADReplication.ps1: -------------------------------------------------------------------------------- 1 | ##Force replicate all your domain controllers. Be sure to change the DOMAIN and TLD in line 11. 2 | 3 | $DomainControllers = Get-ADDomainController -Filter * 4 | ForEach ($DC in $DomainControllers.Name) { 5 | Write-Host "Processing for "$DC -ForegroundColor Green 6 | If ($Mode -eq "ExtraSuper") { 7 | REPADMIN /kcc $DC 8 | REPADMIN /syncall /A /e /q $DC 9 | } 10 | Else { 11 | REPADMIN /syncall $DC "dc=DOMAIN,dc=TLD" /d /e /q 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SendWOLPacket.ps1: -------------------------------------------------------------------------------- 1 | ##Powershell module to send wake on lan packet to networks computers. Helpful in scripting. 2 | 3 | function Send-WOL 4 | { 5 | <# 6 | .SYNOPSIS 7 | Send a WOL packet to a broadcast address 8 | .PARAMETER mac 9 | The MAC address of the device that need to wake up 10 | .PARAMETER ip 11 | The IP address where the WOL packet will be sent to 12 | .EXAMPLE 13 | Send-WOL -mac 00:11:32:21:2D:11 -ip 192.168.8.255 14 | #> 15 | 16 | [CmdletBinding()] 17 | param( 18 | [Parameter(Mandatory=$True,Position=1)] 19 | [string]$mac, 20 | [string]$ip="255.255.255.255", 21 | [int]$port=9 22 | ) 23 | $broadcast = [Net.IPAddress]::Parse($ip) 24 | 25 | $mac=(($mac.replace(":","")).replace("-","")).replace(".","") 26 | $target=0,2,4,6,8,10 | % {[convert]::ToByte($mac.substring($_,2),16)} 27 | $packet = (,[byte]255 * 6) + ($target * 16) 28 | 29 | $UDPclient = new-Object System.Net.Sockets.UdpClient 30 | $UDPclient.Connect($broadcast,$port) 31 | [void]$UDPclient.Send($packet, 102) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /SetADUserExpiration.ps1: -------------------------------------------------------------------------------- 1 | ##Sets expiration date and time for Active Directory User. 2 | 3 | $user = read-Host 'Whats the AD username to set to expire:' 4 | Set-ADAccountExpiration -Identity $user -DateTime '12/08/2016 17:00:00' 5 | Get-ADUser -Identity $user -Properties AccountExpirationDate | Select-Object -Property SamAccountName, AccountExpirationDate 6 | -------------------------------------------------------------------------------- /SetAzureStorageBlobTierToArchive.ps1: -------------------------------------------------------------------------------- 1 | Import-Module AzureRM 2 | 3 | #Define storage account information 4 | $StorageAccount = "STORAGEACCOUNTNAME" 5 | $StorageAccountKey = "STORAGEACCOUNTKEY" 6 | $containername = "CONTAINERNAME" 7 | 8 | #Create a storage context 9 | $context = New-AzureStorageContext -StorageAccountName $StorageAccount -StorageAccountKey $StorageAccountKey 10 | 11 | #Set variables for processing batches & continuation Token 12 | 13 | $MaxReturn = 50000 14 | $Token = $Null 15 | 16 | #Define a blog array for reporting 17 | $blobarray = @() 18 | 19 | #Create a loop to process the whole container in blob batches of 50,000 20 | 21 | do 22 | { 23 | 24 | #Process a total of 50,000 Blobs at a time. This is extremely useful for large containers 25 | $blobs = Get-AzureStorageBlob -Container $containername -Context $context -MaxCount $MaxReturn -ContinuationToken $Token 26 | 27 | #I schedule this script to run every hour, so I've configured the below filter to only process specific blobs. NBLOBS is short for New Blobs! 28 | 29 | $nblobs = $blobs | where {$_.LastModified -gt (Get-Date).AddMinutes(-90)} | Where-Object {$_.ICloudBlob.Properties.StandardBlobTier -eq 'Cool'} 30 | 31 | # A 'For' loop to process the filtered out blobs 32 | 33 | foreach($nblob in $nblobs) { 34 | 35 | #Change the access tier of the newly uploaded blogs 36 | 37 | $nblob.ICloudBlob.SetStandardBlobTier("Archive") 38 | 39 | #Add these blobs to our array 40 | 41 | $blobarray += $nblob 42 | 43 | } 44 | 45 | if($blobs.Length -le 0) { Break;} 46 | 47 | $Token = $blobs[$blobs.Count -1].ContinuationToken; 48 | } 49 | While ($Token -ne $Null) 50 | 51 | #Export results of changed blogs to CSV file 52 | 53 | $timestamp = Get-date -UFormat %d%m%y%H%M 54 | 55 | $fulldate = Get-Date -Format g 56 | 57 | $export = "C:\temp\Blob Tier Updates - $containername $timestamp.csv" 58 | 59 | $blobarray | Select-Object -Property Name, BlobType, LastModified, Length, ContentType, @{n='AccessTier';e={$_.ICloudBlob.Properties.StandardBlobTier}} | Export-Csv $export -NoTypeInformation 60 | 61 | #Email CSV file to pre-determined recipients 62 | 63 | #Start-Sleep -s 5 64 | 65 | #$smtpServer ="8.8.8.8" 66 | #$file = $export 67 | #$att = new-object Net.Mail.Attachment($file) 68 | #$msg = new-object Net.Mail.MailMessage 69 | #$smtp = new-object Net.Mail.SmtpClient($smtpServer) 70 | #$msg.From = "name@test.com" 71 | #$msg.To.Add("name1@test.com") 72 | #$msg.Subject = "$timestamp : Azure Blob Storage Updates" 73 | #$msg.Body = "Report attached for Blob Tier Updates on $containername Storage container on $fulldate" 74 | #$msg.Attachments.Add($att) 75 | #$smtp.Send($msg) 76 | #$att.Dispose() 77 | -------------------------------------------------------------------------------- /Windows10Scrub.ps1: -------------------------------------------------------------------------------- 1 | ##Clean up all the crap out of Windows 10. Uncomment things you want either added or removed accordingly. 2 | 3 | # Ask for elevated permissions if required 4 | If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) { 5 | Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs 6 | Exit 7 | } 8 | 9 | 10 | 11 | ########## 12 | # Privacy Settings 13 | ########## 14 | 15 | # Disable Telemetry 16 | Write-Host "Disabling Telemetry..." 17 | Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 18 | 19 | # Enable Telemetry 20 | # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" 21 | 22 | # Disable Wi-Fi Sense 23 | Write-Host "Disabling Wi-Fi Sense..." 24 | If (!(Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { 25 | New-Item -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null 26 | } 27 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0 28 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0 29 | 30 | # Enable Wi-Fi Sense 31 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1 32 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1 33 | 34 | # Disable SmartScreen Filter 35 | # Write-Host "Disabling SmartScreen Filter..." 36 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "Off" 37 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Type DWord -Value 0 38 | 39 | # Enable SmartScreen Filter 40 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "RequireAdmin" 41 | Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" 42 | 43 | # Disable Bing Search in Start Menu 44 | Write-Host "Disabling Bing Search in Start Menu..." 45 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0 46 | 47 | # Enable Bing Search in Start Menu 48 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" 49 | 50 | # Disable Location Tracking 51 | Write-Host "Disabling Location Tracking..." 52 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0 53 | Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0 54 | 55 | # Enable Location Tracking 56 | # Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1 57 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1 58 | 59 | # Disable Feedback 60 | Write-Host "Disabling Feedback..." 61 | If (!(Test-Path "HKCU:\Software\Microsoft\Siuf\Rules")) { 62 | New-Item -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Force | Out-Null 63 | } 64 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0 65 | 66 | # Enable Feedback 67 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" 68 | 69 | # Disable Advertising ID 70 | Write-Host "Disabling Advertising ID..." 71 | If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) { 72 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null 73 | } 74 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0 75 | 76 | # Enable Advertising ID 77 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" 78 | 79 | # Disable Cortana 80 | Write-Host "Disabling Cortana..." 81 | If (!(Test-Path "HKCU:\Software\Microsoft\Personalization\Settings")) { 82 | New-Item -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Force | Out-Null 83 | } 84 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Type DWord -Value 0 85 | If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization")) { 86 | New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization" -Force | Out-Null 87 | } 88 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1 89 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1 90 | If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore")) { 91 | New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null 92 | } 93 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0 94 | 95 | # Enable Cortana 96 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" 97 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 0 98 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 0 99 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" 100 | 101 | # Restrict Windows Update P2P only to local network 102 | Write-Host "Restricting Windows Update P2P only to local network..." 103 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1 104 | If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) { 105 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null 106 | } 107 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 3 108 | 109 | # Unrestrict Windows Update P2P 110 | # Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" 111 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" 112 | 113 | # Remove AutoLogger file and restrict directory 114 | Write-Host "Removing AutoLogger file and restricting directory..." 115 | $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger" 116 | If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") { 117 | Remove-Item "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl" 118 | } 119 | icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null 120 | 121 | # Unrestrict AutoLogger directory 122 | # $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger" 123 | # icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null 124 | 125 | # Stop and disable Diagnostics Tracking Service 126 | Write-Host "Stopping and disabling Diagnostics Tracking Service..." 127 | Stop-Service "DiagTrack" 128 | Set-Service "DiagTrack" -StartupType Disabled 129 | 130 | # Enable and start Diagnostics Tracking Service 131 | # Set-Service "DiagTrack" -StartupType Automatic 132 | # Start-Service "DiagTrack" 133 | 134 | # Stop and disable WAP Push Service 135 | Write-Host "Stopping and disabling WAP Push Service..." 136 | Stop-Service "dmwappushservice" 137 | Set-Service "dmwappushservice" -StartupType Disabled 138 | 139 | # Enable and start WAP Push Service 140 | # Set-Service "dmwappushservice" -StartupType Automatic 141 | # Start-Service "dmwappushservice" 142 | # Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice" -Name "DelayedAutoStart" -Type DWord -Value 1 143 | 144 | 145 | 146 | ########## 147 | # Service Tweaks 148 | ########## 149 | 150 | # Lower UAC level 151 | # Write-Host "Lowering UAC level..." 152 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 0 153 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 0 154 | 155 | # Raise UAC level 156 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 5 157 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 1 158 | 159 | # Enable sharing mapped drives between users 160 | # Write-Host "Enabling sharing mapped drives between users..." 161 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -Type DWord -Value 1 162 | 163 | # Disable sharing mapped drives between users 164 | # Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" 165 | 166 | # Disable Firewall 167 | # Write-Host "Disabling Firewall..." 168 | # Set-NetFirewallProfile -Profile * -Enabled False 169 | 170 | # Enable Firewall 171 | Set-NetFirewallProfile -Profile * -Enabled True 172 | 173 | # Disable Windows Defender 174 | # Write-Host "Disabling Windows Defender..." 175 | # Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Type DWord -Value 1 176 | 177 | # Enable Windows Defender 178 | # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" 179 | 180 | # Disable Windows Update automatic restart 181 | Write-Host "Disabling Windows Update automatic restart..." 182 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 1 183 | 184 | # Enable Windows Update automatic restart 185 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 0 186 | 187 | # Stop and disable Home Groups services 188 | Write-Host "Stopping and disabling Home Groups services..." 189 | Stop-Service "HomeGroupListener" 190 | Set-Service "HomeGroupListener" -StartupType Disabled 191 | Stop-Service "HomeGroupProvider" 192 | Set-Service "HomeGroupProvider" -StartupType Disabled 193 | 194 | # Enable and start Home Groups services 195 | # Set-Service "HomeGroupListener" -StartupType Manual 196 | # Set-Service "HomeGroupProvider" -StartupType Manual 197 | # Start-Service "HomeGroupProvider" 198 | 199 | # Disable Remote Assistance 200 | Write-Host "Disabling Remote Assistance..." 201 | Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 0 202 | 203 | # Enable Remote Assistance 204 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 1 205 | 206 | # Enable Remote Desktop w/o Network Level Authentication 207 | # Write-Host "Enabling Remote Desktop w/o Network Level Authentication..." 208 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 0 209 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 0 210 | 211 | # Disable Remote Desktop 212 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 1 213 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 1 214 | 215 | 216 | 217 | ########## 218 | # UI Tweaks 219 | ########## 220 | 221 | # Disable Action Center 222 | # Write-Host "Disabling Action Center..." 223 | # If (!(Test-Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer")) { 224 | # New-Item -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" | Out-Null 225 | # } 226 | # Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" -Type DWord -Value 1 227 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -Type DWord -Value 0 228 | 229 | # Enable Action Center 230 | # Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" 231 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" 232 | 233 | # Disable Lock screen 234 | #Write-Host "Disabling Lock screen..." 235 | #If (!(Test-Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization")) { 236 | # New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" | Out-Null 237 | #} 238 | #Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -Type DWord -Value 1 239 | 240 | # Enable Lock screen 241 | Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" 242 | 243 | # Disable Autoplay 244 | Write-Host "Disabling Autoplay..." 245 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1 246 | 247 | # Enable Autoplay 248 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 0 249 | 250 | # Disable Autorun for all drives 251 | Write-Host "Disabling Autorun for all drives..." 252 | #If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) { 253 | # New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null 254 | #Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255 255 | 256 | # Enable Autorun 257 | Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" 258 | 259 | #Disable Sticky keys prompt 260 | Write-Host "Disabling Sticky keys prompt..." 261 | Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "506" 262 | 263 | # Enable Sticky keys prompt 264 | # Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "510" 265 | 266 | # Hide Search button / box 267 | Write-Host "Hiding Search Box / Button..." 268 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0 269 | 270 | # Show Search button / box 271 | #Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" 272 | 273 | # Hide Task View button 274 | # Write-Host "Hiding Task View button..." 275 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 0 276 | 277 | # Show Task View button 278 | Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" 279 | 280 | # Show small icons in taskbar 281 | # Write-Host "Showing small icons in taskbar..." 282 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Type DWord -Value 1 283 | 284 | # Show large icons in taskbar 285 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" 286 | 287 | # Show titles in taskbar 288 | #Write-Host "Showing titles in taskbar..." 289 | #Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Type DWord -Value 1 290 | 291 | # Hide titles in taskbar 292 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" 293 | 294 | # Show all tray icons 295 | Write-Host "Showing all tray icons..." 296 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" -Type DWord -Value 0 297 | 298 | # Hide tray icons as needed 299 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" 300 | 301 | # Show known file extensions 302 | Write-Host "Showing known file extensions..." 303 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0 304 | 305 | # Hide known file extensions 306 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1 307 | 308 | # Show hidden files 309 | Write-Host "Showing hidden files..." 310 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 1 311 | 312 | # Hide hidden files 313 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 2 314 | 315 | # Change default Explorer view to "Computer" 316 | Write-Host "Changing default Explorer view to `"Computer`"..." 317 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1 318 | 319 | # Change default Explorer view to "Quick Access" 320 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" 321 | 322 | # Show Computer shortcut on desktop 323 | Write-Host "Showing Computer shortcut on desktop..." 324 | If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu")) { 325 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" | Out-Null 326 | } 327 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0 328 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0 329 | 330 | # Hide Computer shortcut from desktop 331 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" 332 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" 333 | 334 | # Remove Desktop icon from computer namespace 335 | # Write-Host "Removing Desktop icon from computer namespace..." 336 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" -Recurse -ErrorAction SilentlyContinue 337 | 338 | # Add Desktop icon to computer namespace 339 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" 340 | 341 | # Remove Documents icon from computer namespace 342 | # Write-Host "Removing Documents icon from computer namespace..." 343 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" -Recurse -ErrorAction SilentlyContinue 344 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" -Recurse -ErrorAction SilentlyContinue 345 | 346 | # Add Documents icon to computer namespace 347 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" 348 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" 349 | 350 | # Remove Downloads icon from computer namespace 351 | # Write-Host "Removing Downloads icon from computer namespace..." 352 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" -Recurse -ErrorAction SilentlyContinue 353 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" -Recurse -ErrorAction SilentlyContinue 354 | 355 | # Add Downloads icon to computer namespace 356 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" 357 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" 358 | 359 | # Remove Music icon from computer namespace 360 | Write-Host "Removing Music icon from computer namespace..." 361 | Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" -Recurse -ErrorAction SilentlyContinue 362 | Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" -Recurse -ErrorAction SilentlyContinue 363 | 364 | # Add Music icon to computer namespace 365 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" 366 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" 367 | 368 | # Remove Pictures icon from computer namespace 369 | Write-Host "Removing Pictures icon from computer namespace..." 370 | Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" -Recurse -ErrorAction SilentlyContinue 371 | Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" -Recurse -ErrorAction SilentlyContinue 372 | 373 | # Add Pictures icon to computer namespace 374 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" 375 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" 376 | 377 | # Remove Videos icon from computer namespace 378 | Write-Host "Removing Videos icon from computer namespace..." 379 | Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" -Recurse -ErrorAction SilentlyContinue 380 | Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" -Recurse -ErrorAction SilentlyContinue 381 | 382 | # Add Videos icon to computer namespace 383 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" 384 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" 385 | 386 | ## Add secondary en-US keyboard 387 | #Write-Host "Adding secondary en-US keyboard..." 388 | #$langs = Get-WinUserLanguageList 389 | #$langs.Add("en-US") 390 | #Set-WinUserLanguageList $langs -Force 391 | 392 | # Remove secondary en-US keyboard 393 | # $langs = Get-WinUserLanguageList 394 | # Set-WinUserLanguageList ($langs | ? {$_.LanguageTag -ne "en-US"}) -Force 395 | 396 | 397 | 398 | ########## 399 | # Remove unwanted applications 400 | ########## 401 | 402 | # Disable OneDrive 403 | # Write-Host "Disabling OneDrive..." 404 | # If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive")) { 405 | # New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" | Out-Null 406 | # } 407 | # Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1 408 | 409 | # Enable OneDrive 410 | # Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" 411 | 412 | # Uninstall OneDrive 413 | # Write-Host "Uninstalling OneDrive..." 414 | # Stop-Process -Name OneDrive -ErrorAction SilentlyContinue 415 | # Start-Sleep -s 3 416 | # $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" 417 | # If (!(Test-Path $onedrive)) { 418 | # $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" 419 | # } 420 | # Start-Process $onedrive "/uninstall" -NoNewWindow -Wait 421 | # Start-Sleep -s 3 422 | # Stop-Process -Name explorer -ErrorAction SilentlyContinue 423 | # Start-Sleep -s 3 424 | # Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue 425 | # Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue 426 | # Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse -ErrorAction SilentlyContinue 427 | # If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { 428 | # Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue 429 | # } 430 | # If (!(Test-Path "HKCR:")) { 431 | # New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 432 | # } 433 | # Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue 434 | # Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue 435 | 436 | # Install OneDrive 437 | # $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" 438 | # If (!(Test-Path $onedrive)) { 439 | # $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" 440 | # } 441 | # Start-Process $onedrive -NoNewWindow 442 | 443 | # Uninstall default Microsoft applications 444 | Write-Host "Uninstalling default Microsoft applications..." 445 | Get-AppxPackage "Microsoft.3DBuilder" | Remove-AppxPackage 446 | Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage 447 | Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage 448 | Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage 449 | Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage 450 | Get-AppxPackage "Microsoft.Getstarted" | Remove-AppxPackage 451 | Get-AppxPackage "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage 452 | Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage 453 | # Get-AppxPackage "Microsoft.Office.OneNote" | Remove-AppxPackage 454 | Get-AppxPackage "Microsoft.People" | Remove-AppxPackage 455 | #Get-AppxPackage "Microsoft.SkypeApp" | Remove-AppxPackage 456 | # Get-AppxPackage "Microsoft.Windows.Photos" | Remove-AppxPackage 457 | Get-AppxPackage "Microsoft.WindowsAlarms" | Remove-AppxPackage 458 | Get-AppxPackage "Microsoft.WindowsCamera" | Remove-AppxPackage 459 | Get-AppxPackage "microsoft.windowscommunicationsapps" | Remove-AppxPackage 460 | Get-AppxPackage "Microsoft.WindowsMaps" | Remove-AppxPackage 461 | Get-AppxPackage "Microsoft.WindowsPhone" | Remove-AppxPackage 462 | Get-AppxPackage "Microsoft.WindowsSoundRecorder" | Remove-AppxPackage 463 | Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage 464 | Get-AppxPackage "Microsoft.ZuneMusic" | Remove-AppxPackage 465 | Get-AppxPackage "Microsoft.ZuneVideo" | Remove-AppxPackage 466 | Get-AppxPackage "Microsoft.AppConnector" | Remove-AppxPackage 467 | Get-AppxPackage "Microsoft.ConnectivityStore" | Remove-AppxPackage 468 | Get-AppxPackage "Microsoft.Office.Sway" | Remove-AppxPackage 469 | Get-AppxPackage "Microsoft.Messaging" | Remove-AppxPackage 470 | Get-AppxPackage "Microsoft.CommsPhone" | Remove-AppxPackage 471 | Get-AppxPackage "9E2F88E3.Twitter" | Remove-AppxPackage 472 | Get-AppxPackage "king.com.CandyCrushSodaSaga" | Remove-AppxPackage 473 | 474 | # Install default Microsoft applications 475 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.3DBuilder").InstallLocation)\AppXManifest.xml" 476 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingFinance").InstallLocation)\AppXManifest.xml" 477 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingNews").InstallLocation)\AppXManifest.xml" 478 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingSports").InstallLocation)\AppXManifest.xml" 479 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingWeather").InstallLocation)\AppXManifest.xml" 480 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Getstarted").InstallLocation)\AppXManifest.xml" 481 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.MicrosoftOfficeHub").InstallLocation)\AppXManifest.xml" 482 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.MicrosoftSolitaireCollection").InstallLocation)\AppXManifest.xml" 483 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Office.OneNote").InstallLocation)\AppXManifest.xml" 484 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.People").InstallLocation)\AppXManifest.xml" 485 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.SkypeApp").InstallLocation)\AppXManifest.xml" 486 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Windows.Photos").InstallLocation)\AppXManifest.xml" 487 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsAlarms").InstallLocation)\AppXManifest.xml" 488 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsCamera").InstallLocation)\AppXManifest.xml" 489 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.windowscommunicationsapps").InstallLocation)\AppXManifest.xml" 490 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsMaps").InstallLocation)\AppXManifest.xml" 491 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsPhone").InstallLocation)\AppXManifest.xml" 492 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsSoundRecorder").InstallLocation)\AppXManifest.xml" 493 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.XboxApp").InstallLocation)\AppXManifest.xml" 494 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ZuneMusic").InstallLocation)\AppXManifest.xml" 495 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ZuneVideo").InstallLocation)\AppXManifest.xml" 496 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.AppConnector").InstallLocation)\AppXManifest.xml" 497 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ConnectivityStore").InstallLocation)\AppXManifest.xml" 498 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Office.Sway").InstallLocation)\AppXManifest.xml" 499 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Messaging").InstallLocation)\AppXManifest.xml" 500 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.CommsPhone").InstallLocation)\AppXManifest.xml" 501 | # In case you have removed them for good, you can try to restore the files using installation medium as follows 502 | # New-Item C:\Mnt -Type Directory | Out-Null 503 | # dism /Mount-Image /ImageFile:D:\sources\install.wim /index:1 /ReadOnly /MountDir:C:\Mnt 504 | # robocopy /S /SEC /R:0 "C:\Mnt\Program Files\WindowsApps" "C:\Program Files\WindowsApps" 505 | # dism /Unmount-Image /Discard /MountDir:C:\Mnt 506 | # Remove-Item -Path C:\Mnt -Recurse 507 | 508 | # Uninstall Windows Media Player 509 | # Write-Host "Uninstalling Windows Media Player..." 510 | # dism /online /Disable-Feature /FeatureName:MediaPlayback /Quiet /NoRestart 511 | 512 | # Install Windows Media Player 513 | # dism /online /Enable-Feature /FeatureName:MediaPlayback /Quiet /NoRestart 514 | 515 | # Uninstall Work Folders Client 516 | # Write-Host "Uninstalling Work Folders Client..." 517 | # dism /online /Disable-Feature /FeatureName:WorkFolders-Client /Quiet /NoRestart 518 | 519 | # Install Work Folders Client 520 | # dism /online /Enable-Feature /FeatureName:WorkFolders-Client /Quiet /NoRestart 521 | 522 | # Set Photo Viewer as default for bmp, gif, jpg and png 523 | Write-Host "Setting Photo Viewer as default for bmp, gif, jpg, png and tif..." 524 | If (!(Test-Path "HKCR:")) { 525 | New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 526 | } 527 | ForEach ($type in @("Paint.Picture", "giffile", "jpegfile", "pngfile")) { 528 | New-Item -Path $("HKCR:\$type\shell\open") -Force | Out-Null 529 | New-Item -Path $("HKCR:\$type\shell\open\command") | Out-Null 530 | Set-ItemProperty -Path $("HKCR:\$type\shell\open") -Name "MuiVerb" -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" 531 | Set-ItemProperty -Path $("HKCR:\$type\shell\open\command") -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" 532 | } 533 | 534 | # Remove or reset default open action for bmp, gif, jpg and png 535 | # If (!(Test-Path "HKCR:")) { 536 | # New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 537 | # } 538 | # Remove-Item -Path "HKCR:\Paint.Picture\shell\open" -Recurse 539 | # Remove-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "MuiVerb" 540 | # Set-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "CommandId" -Type String -Value "IE.File" 541 | # Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "(Default)" -Type String -Value "`"$env:SystemDrive\Program Files\Internet Explorer\iexplore.exe`" %1" 542 | # Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "DelegateExecute" -Type String -Value "{17FE9752-0B5A-4665-84CD-569794602F5C}" 543 | # Remove-Item -Path "HKCR:\jpegfile\shell\open" -Recurse 544 | # Remove-Item -Path "HKCR:\pngfile\shell\open" -Recurse 545 | 546 | # Show Photo Viewer in "Open with..." 547 | Write-Host "Showing Photo Viewer in `"Open with...`"" 548 | If (!(Test-Path "HKCR:")) { 549 | New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 550 | } 551 | New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Force | Out-Null 552 | New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Force | Out-Null 553 | Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Name "MuiVerb" -Type String -Value "@photoviewer.dll,-3043" 554 | Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" 555 | Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Name "Clsid" -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" 556 | 557 | # Remove Photo Viewer from "Open with..." 558 | # If (!(Test-Path "HKCR:")) { 559 | # New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 560 | # } 561 | # Remove-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Recurse 562 | 563 | ########## 564 | # Restart 565 | ########## 566 | Write-Host 567 | Write-Host "Press any key to restart your system..." -ForegroundColor Black -BackgroundColor White 568 | $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") 569 | Write-Host "Restarting..." 570 | Restart-Computer 571 | -------------------------------------------------------------------------------- /checkFSMORoles.ps1: -------------------------------------------------------------------------------- 1 | $domain = read-Host 'FQDN:' 2 | get-adforest $domain | format-list schemamaster,domainnamingmaster 3 | get-addomain $domain | format-list pdcemulator,ridmaster,infrastructuremaster -------------------------------------------------------------------------------- /profile.ps1: -------------------------------------------------------------------------------- 1 | #Put this file under your C:\users\username\my documents\windowspowershell\ folder 2 | 3 | function prompt 4 | { 5 | # New nice WindowTitle 6 | $Host.UI.RawUI.WindowTitle = "PowerShell v" + (get-host).Version.Major + "." + (get-host).Version.Minor + " (" + $pwd.Provider.Name + ") " + $pwd.Path 7 | 8 | # Admin ? 9 | if( ( 10 | New-Object Security.Principal.WindowsPrincipal ( 11 | [Security.Principal.WindowsIdentity]::GetCurrent()) 12 | ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) 13 | { 14 | # Admin-mark in WindowTitle 15 | $Host.UI.RawUI.WindowTitle = "[Admin] " + $Host.UI.RawUI.WindowTitle 16 | 17 | # Admin-mark on prompt 18 | Write-Host "[" -nonewline -foregroundcolor DarkGray 19 | Write-Host "Admin" -nonewline -foregroundcolor Red 20 | Write-Host "] " -nonewline -foregroundcolor DarkGray 21 | } 22 | 23 | # Show providername if you are outside FileSystem 24 | if ($pwd.Provider.Name -ne "FileSystem") { 25 | Write-Host "[" -nonewline -foregroundcolor DarkGray 26 | Write-Host $pwd.Provider.Name -nonewline -foregroundcolor Gray 27 | Write-Host "] " -nonewline -foregroundcolor DarkGray 28 | } 29 | 30 | # Split path and write \ in a gray 31 | $pwd.Path.Split("\") | foreach { 32 | Write-Host $_ -nonewline -foregroundcolor Yellow 33 | Write-Host "\" -nonewline -foregroundcolor Gray 34 | } 35 | 36 | # Backspace last \ and write > 37 | Write-Host "`b>" -nonewline -foregroundcolor Gray 38 | 39 | return " " 40 | } 41 | 42 | function Out-vCard { 43 | $input | ForEach-Object { 44 | 45 | $filename = "c:\users\username\desktop\" + $_.Name + ".vcf" 46 | Remove-Item $filename -ErrorAction SilentlyContinue 47 | add-content -path $filename "BEGIN:VCARD" 48 | add-content -path $filename "VERSION:2.1" 49 | add-content -path $filename ("N:" + "" + $_.Surname + ";" + $_.GivenName) 50 | add-content -path $filename ("FN:" + $_.Name) 51 | add-content -path $filename ("EMAIL:" + $_.Mail) 52 | add-content -path $filename ("ORG:" + $_.Company) 53 | add-content -path $filename ("TITLE:" + $_.Title) 54 | add-content -path $filename ("TEL;WORK;VOICE:" + $_.PhoneNumber) 55 | add-content -path $filename ("TEL;HOME;VOICE:" + $_.HomePhone) 56 | add-content -path $filename ("TEL;CELL;VOICE:" + $_.MobilePhone) 57 | add-content -path $filename ("TEL;WORK;FAX:" + $_.Fax) 58 | add-content -path $filename ("ADR;WORK;PREF:" + ";;" + $_.StreetAddress + ";" + $_.PostalCode + " " + $_.City + ";" + $_.co + ";;" + $_.Country) 59 | add-content -path $filename ("URL;WORK:" + $_.WebPage) 60 | add-content -path $filename ("EMAIL;PREF;INTERNET:" + $_.Email) 61 | add-content -path $filename "END:VCARD" 62 | } 63 | } 64 | --------------------------------------------------------------------------------