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
$Remediate = $false | |
Import-Module WebAdministration | |
$UseAppPoolIdentity = (Get-WebConfigurationProperty -Filter 'system.WebServer/security/authentication/AnonymousAuthentication' -Name username -Location 'WSUS Administration/Content') -eq '' | |
switch ($UseAppPoolIdentity) { | |
$true { | |
$true | |
} | |
$false { | |
switch ($Remediate) { | |
$true { |
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
$Remediate = $false | |
$PathShouldBeROOT = Get-ItemProperty -Path "registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup" -Name ContentDir | Select-Object -ExpandProperty ContentDir | |
$PathShouldBe = Join-Path -Path $PathShouldBeROOT -ChildPath 'WSUSContent' | |
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration") | |
$serverManager = New-Object Microsoft.Web.Administration.ServerManager | |
$site = $serverManager.Sites | Where-Object { $_.Name -eq "WSUS Administration" } | |
$rootApp = $site.Applications | Where-Object { $_.Path -eq "/" } | |
$rootVdir = $rootApp.VirtualDirectories | Where-Object { $_.Path -eq "/Content" } |
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
Set-NetTCPSetting -SettingName InternetCustom -CongestionProvider LEDBAT | |
New-NetTransportFilter -SettingName InternetCustom -LocalPortStart 8530 -LocalPortEnd 8530 -RemotePortStart 0 -RemotePortEnd 65535 |
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
/* | |
This query will show you the count of records per Hardware Inventory class in your HinvChangeLog table for a period between | |
21 days ago, and 28 days ago | |
*/ | |
SELECT map.DisplayName | |
, map.InvClassName AS 'Inventory View' | |
, COUNT(HINV.RecordID) | |
FROM HinvChangeLog hinv | |
LEFT JOIN v_GroupMap map ON map.GroupID = hinv.GroupKey | |
WHERE hinv.TimeKey > DATEADD(day, -28, GETDATE()) AND hinv.TimeKey < DATEADD(day, -21, GETDATE()) |
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
/* | |
This query will show you the count of records per Hardware Inventory class in your HinvChangeLog table. | |
This can help you identify a class that is create a lot of hardware inventory 'traffic' and potentially bloating | |
your database. | |
*/ | |
SELECT map.DisplayName | |
, map.InvClassName AS 'Inventory View' | |
, COUNT(HINV.RecordID) | |
FROM HinvChangeLog hinv | |
LEFT JOIN v_GroupMap map ON map.GroupID = hinv.GroupKey |
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
switch ($No_SMS_Exists) { | |
$false { | |
Write-CMLogEntry -Value "Found that the 'No_SMS_On_Drive.sms' does not exist on $DrivePath - will check for DP folders." | |
$SMS_PackageShareFolder = [string]::Format('SMSPKG{0}$', $Volume.DriveLetter) | |
$SMS_PackageShareFolderPath = Get-ChildItem -Path $DrivePath -Filter $SMS_PackageShareFolder | |
if ($null -ne $SMS_PackageShareFolderPath) { | |
Write-CMLogEntry -Value "Adding $($SMS_PackageShareFolderPath.FullName) to inclusion list for $DrivePath" | |
$Include[$SMS_PackageShareFolderPath.FullName] = $true | |
} | |
$SCCMContentLibFolderPath = Get-ChildItem -Path $DrivePath -Filter 'SCCMContentLib' |
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
if ($Include -ne @{ }) { | |
Write-CMLogEntry -Value "Marking folders [$($Include.Keys -join '; ')] for inclusion in dedplucation - will process $DrivePath" | |
$AllFolders = Get-ChildItem -Path $DrivePath -Directory | |
$Exclude = $AllFolders.FullName | Where-Object { $_ -notin $Include.Keys } | |
$Excludes = $Exclude -replace $DrivePath |
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
$TimeFrame = (Get-Date).AddMinutes(-17) | |
$Filter = @{ | |
LogName = 'System' | |
StartTime = $TimeFrame | |
Id = '19' | |
ProviderName = 'Microsoft-Windows-WindowsUpdateClient' | |
} | |
$Events = Get-WinEvent -FilterHashtable $Filter | |
foreach ($Event in $Events) { | |
switch -Regex ($Event.Message) { |
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
powershell.exe -command "&{$TimeFrame=(Get-Date).AddMinutes(-17);$Filter=@{LogName='System';StartTime=$TimeFrame;Id='19';ProviderName='Microsoft-Windows-WindowsUpdateClient';};$Events=Get-WinEvent -FilterHashtable $Filter;foreach($Event in $Events){switch -Regex ($Event.Message){'Servicing Stack Update'{foreach($Schedule in @('108','113')){$ScheduleString = [string]::Format('{{00000000-0000-0000-0000-000000000{0}}}',$Schedule);$invokeWmiMethodSplat=@{Name='TriggerSchedule';Namespace='root\ccm';Class='sms_client';ArgumentList=$ScheduleString;ErrorAction='Stop';};Invoke-WmiMethod @invokeWmiMethodSplat;}}}}}" |
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
#region generate PSCustomObject that we will loop through to create DeploymentTypes | |
$DeploymentTypes = foreach ($XML in $FilteredXML_Configs) { | |
#region Load XML and manipulate based on input parameters, and gather information | |
$Config = $XML.Name | |
$ConfigXML = [xml]::new() | |
$ConfigXML.PreserveWhitespace = $true | |
$ConfigXML.Load($XML.FullName) | |
$ConfigXML.Configuration.AppSettings.Setup.Value = $Company | |
$ConfigXML.Configuration.Add.OfficeClientEdition = $XML_Bitness | |
$ConfigXML.Configuration.Add.Version = $FullBuildNumber |