This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean User Profiles | |
# Makes WMI call to list profiles, excluding system accounts | |
# Deletes profiles whose LastUseTime is older than a set number of days | |
Param( | |
# Where-Object $Threshold is number of days as an integer; Profiles older than $Threshold days will be deleted | |
[Parameter(Position=0,Mandatory=$true)] | |
[int]$Threshold | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Clear-WSUSConfig { | |
Stop-Service wuauserv -force | |
Set-ItemProperty -Path HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name UseWUServer -Value 0 | |
Start-Service wuauserv | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Now that we don't run our own WSUS, clear WSUS config from registry if causing conflicts. | |
function Clear-WSUSConfig { | |
Stop-Service wuauserv -force | |
Set-ItemProperty -Path HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name UseWUServer -Value 0 | |
Start-Service wuauserv | |
} | |
# Any errors encountered even when running as admin usually require manually changing Windows Update/Component servicing settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#----------------------------------------------- | |
# Warning Prompt - Windows User Logon Script | |
#----------------------------------------------- | |
# Set some variables that we'll use to craft the prompt in the next section | |
$message = "" | |
$title = "" | |
# We'll use a bit of .NET framework here... | |
# First, we have to add the assembly as it does not exist by default in PowerShell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#----------------------------------------------- | |
# Two-Step Warning - Windows User Logon Script | |
#----------------------------------------------- | |
# Set deadline as a DateTime object - this is important as there are multiple ways Windows formats time | |
[datetime]$deadline = "05/01/2021 00:00" | |
# Set countdown as deadline minus the current date at time of logon | |
$countdown = $deadline - (Get-Date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$key = '' | |
$MAK = Get-WmiObject -Query "Select * from SoftwareLicensingService" | |
$MAK.InstallProductKey($key) | |
$MAK.RefreshLicenseStatus() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$provisioned = "Microsoft.BingWeather","Microsoft.GetHelp","Microsoft.Getstarted","Microsoft.Messaging","Microsoft.MicrosoftOfficeHub","Microsoft.MicrosoftSolitaireCollection","Microsoft.Office.OneNote","Microsoft.OneConnect","Microsoft.People","Microsoft.People","Microsoft.Wallet","microsoft.windowscommunicationsapp","Microsoft.WindowsFeedbackHub","Microsoft.WindowsMaps","Microsoft.YourPhone","Microsoft.ZuneMusic","Microsoft.ZuneVideo" | |
$appx = "Microsoft.Windows.PeopleExperienceHost","Microsoft.BingWeather","Microsoft.GetHelp","Microsoft.Getstarted","Microsoft.Messaging","Microsoft.MicrosoftOfficeHub","Microsoft.MicrosoftSolitaireCollection","Microsoft.Office.OneNote","Microsoft.OneConnect","Microsoft.People","Microsoft.SkypeApp","Microsoft.Wallet","microsoft.windowscommunicationsapps","Microsoft.WindowsFeedbackHub","Microsoft.WindowsMaps","Microsoft.YourPhone","Microsoft.ZuneMusic","Microsoft.ZuneVideo" | |
ForEach ($app in $provisioned) { | |
Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
# Specify "-Legacy" if Internet Explorer is still needed for compatibility with apps | |
[Parameter(Mandatory=$false)] | |
[Switch] | |
$Legacy, | |
# Specify "-IncludeWSL" to enable Windows Subsystem for Linux for IT Staff or approved faculty | |
[Parameter(Mandatory=$false)] | |
[Switch] | |
$IncludeWSL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable Windows Consumer Experience via the Registry | |
$regPath = "HKLM:\\SOFTWARE\Policies\Microsoft\Windows\CloudContent" | |
$regName = "DisableWindowsConsumerFeatures" | |
$regValue = "1" | |
if (!(Test-Path -Path $regPath)) { | |
New-Item -Path $regPath | |
Try { | |
New-ItemProperty -Path $regPath -Name $regName -Value $regValue -PropertyType DWORD |
OlderNewer