├── Modules ├── placeholder.txt ├── CMOperations │ ├── LICENSE │ └── CMOperations.psd1 └── Scripts │ ├── Set-WifiProfile.PS1 │ └── Modify-BootStrapInfo.PS1 ├── Reporting ├── SCConfigMgr-PatchingDashboardV2.5.pbit ├── SCConfigMGR-Patch-ComplianceV1.0.0.8.pbit └── Export-CMReports.ps1 ├── README.md ├── Operating System Deployment ├── Windows Servicing │ ├── Invoke-CMResetWinRE.ps1 │ ├── Invoke-CMDetectCurrentOSVersion.ps1 │ ├── Invoke-CMDetectMBRPartitions.ps1 │ ├── Invoke-CMDetectBitLockerEncryption.ps1 │ └── Invoke-CMDetectFirmwareMode.ps1 ├── Invoke-TSDumpVariables.ps1 ├── Invoke-DellCCTKCheck.ps1 ├── Enable-UbuntuForWindows.ps1 ├── Set-WindowsDefenderSetting.ps1 ├── BIOS │ └── Invoke-MicrosoftBIOSUpdate.ps1 ├── Enable-CredentialGuard.ps1 ├── Invoke-ITMaintenanceMessage.ps1 ├── TPM │ └── Invoke-ManageTPMOwnership.ps1 ├── Build and Capture │ └── Set-CMWindowsStoreUpdates.ps1 └── Invoke-TPMOwnerPassword.ps1 ├── Application ├── Get-MSIFileInformation.ps1 ├── ConvertFrom-CMApplicationCIUniqueID.ps1 ├── Add-CMApplicationRequirementRule.ps1 ├── Get-CMApplicationsRequirementPrimaryDevice.ps1 ├── Start-ApplicationDistribution.ps1 ├── Get-CMApplicationWithDependency.ps1 └── Set-CMApplicationPostInstallBehavior.ps1 ├── Console Extension ├── CreateSoftwareUpdateGroup │ └── CreateSoftwareUpdateGroup.xml ├── GetMaintenanceWindows │ └── MW.xml └── DellWarranty │ └── 3.0 │ ├── DellWarranty.xml │ └── MainWindow.xaml ├── Device Collection ├── Rename-CMCollections.ps1 └── Remove-DeviceFromCollection.ps1 ├── Site Administration ├── Set-CMDiscoveryMethodADGroupScope.ps1 ├── Set-CMMaxMIFSize.ps1 ├── Get-CMIPRangeBoundary.ps1 ├── Set-CMAdditionalUpdateLanguagesForOffice365.ps1 └── Set-CMCloudManagementGatewayState.ps1 ├── Client ├── Clean-CMClientCache.ps1 ├── Get-CMDeviceModels.ps1 ├── Get-CMDeviceIPAddresses.ps1 └── Import-CMDevice.ps1 ├── Compliance Settings └── Set-OPPUpdateChannel.ps1 ├── Content ├── Invoke-CMFailedContentRefresh.ps1 └── Invoke-CMDeploymentTypeContentUpdate.ps1 ├── Software Updates ├── ConvertTo-CMSoftwareUpdate.ps1 ├── Invoke-ADRDeploymentPackage.ps1 ├── Add-CMWSUSScanRetryErrorCodes.ps1 └── New-CMDeploymentPackage.ps1 ├── Package └── Get-CMDisabledPrograms.ps1 ├── Migration ├── Import-CMStatusMessageQuery.ps1 └── Import-CMQuery.ps1 ├── Software Distribution └── Install-MBAMClient.ps1 └── Maintenance Windows ├── Get-CMDeviceMaintenanceWindow.ps1 └── Remove-YearlyMWindow.PS1 /Modules/placeholder.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Reporting/SCConfigMgr-PatchingDashboardV2.5.pbit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSEndpointMgr/ConfigMgr/HEAD/Reporting/SCConfigMgr-PatchingDashboardV2.5.pbit -------------------------------------------------------------------------------- /Reporting/SCConfigMGR-Patch-ComplianceV1.0.0.8.pbit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSEndpointMgr/ConfigMgr/HEAD/Reporting/SCConfigMGR-Patch-ComplianceV1.0.0.8.pbit -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ConfigMgr 2 | System Center Configuration Manager scripts 3 | 4 | Scripts are provided as is with no liability and should be tested in a controlled environment. 5 | -------------------------------------------------------------------------------- /Operating System Deployment/Windows Servicing/Invoke-CMResetWinRE.ps1: -------------------------------------------------------------------------------- 1 | # Disable WinRE 2 | try { 3 | Start-Process -FilePath "reagentc.exe" -ArgumentList "/Disable" -Wait -ErrorAction Stop 4 | } 5 | catch [System.Exception] { 6 | Write-Warning -Message "An error occured while disabling WinRE. Error message: $($_.Exception.Message)" ; exit 1 7 | } 8 | 9 | # Enable WinRE 10 | try { 11 | Start-Process -FilePath "reagentc.exe" -ArgumentList "/Enable" -Wait -ErrorAction Stop 12 | } 13 | catch [System.Exception] { 14 | Write-Warning -Message "An error occured while enabling WinRE. Error message: $($_.Exception.Message)" ; exit 1 15 | } -------------------------------------------------------------------------------- /Operating System Deployment/Windows Servicing/Invoke-CMDetectCurrentOSVersion.ps1: -------------------------------------------------------------------------------- 1 | # Load Microsoft.SMS.TSEnvironment COM object 2 | try { 3 | $TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment -ErrorAction Stop 4 | } 5 | catch [System.Exception] { 6 | Write-Warning -Message "Unable to construct Microsoft.SMS.TSEnvironment object" ; exit 1 7 | } 8 | 9 | # Determine current OS version 10 | $BuildNumber = Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber 11 | 12 | # Set task sequence variable 13 | try { 14 | $TSEnvironment.Value("OSDCurrentOSVersion") = "$($BuildNumber)" 15 | } 16 | catch [System.Exception] { 17 | Write-Warning -Message "An error occured while setting task sequence variable. Error message: $($_.Exception.Message)" ; exit 1 18 | } -------------------------------------------------------------------------------- /Application/Get-MSIFileInformation.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [parameter(Mandatory=$true)] 3 | [IO.FileInfo]$Path, 4 | [parameter(Mandatory=$true)] 5 | [ValidateSet("ProductCode","ProductVersion","ProductName")] 6 | [string]$Property 7 | ) 8 | try { 9 | $WindowsInstaller = New-Object -ComObject WindowsInstaller.Installer 10 | $MSIDatabase = $WindowsInstaller.GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$WindowsInstaller,@($Path.FullName,0)) 11 | $Query = "SELECT Value FROM Property WHERE Property = '$($Property)'" 12 | $View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query)) 13 | $View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null) 14 | $Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null) 15 | $Value = $Record.GetType().InvokeMember("StringData","GetProperty",$null,$Record,1) 16 | return $Value 17 | } 18 | catch { 19 | Write-Output $_.Exception.Message 20 | } -------------------------------------------------------------------------------- /Operating System Deployment/Windows Servicing/Invoke-CMDetectMBRPartitions.ps1: -------------------------------------------------------------------------------- 1 | # Load Microsoft.SMS.TSEnvironment COM object 2 | try { 3 | $TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment -ErrorAction Stop 4 | } 5 | catch [System.Exception] { 6 | Write-Warning -Message "Unable to construct Microsoft.SMS.TSEnvironment object" ; exit 1 7 | } 8 | 9 | # Detect amount of partitions for system drive 10 | $DriveLetter = $env:SystemDrive.Substring(0,1) 11 | $SystemDrivePartitionCount = (Get-Partition -DriveLetter $DriveLetter | Measure-Object).Count 12 | 13 | # Set task sequence variable 14 | try { 15 | if ($SystemDrivePartitionCount -le 3) { 16 | $TSEnvironment.Value("OSDConvertToGPT") = "True" 17 | } 18 | else { 19 | $TSEnvironment.Value("OSDConvertToGPT") = "False" 20 | } 21 | } 22 | catch [System.Exception] { 23 | Write-Warning -Message "An error occured while setting task sequence variable. Error message: $($_.Exception.Message)" ; exit 1 24 | } -------------------------------------------------------------------------------- /Operating System Deployment/Windows Servicing/Invoke-CMDetectBitLockerEncryption.ps1: -------------------------------------------------------------------------------- 1 | # Load Microsoft.SMS.TSEnvironment COM object 2 | try { 3 | $TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment -ErrorAction Stop 4 | } 5 | catch [System.Exception] { 6 | Write-Warning -Message "Unable to construct Microsoft.SMS.TSEnvironment object" ; exit 1 7 | } 8 | 9 | # Detect encrypted drives 10 | $OSDriveEncrypted = $false 11 | $EncryptedVolumes = Get-WmiObject -Namespace "root\cimv2\Security\MicrosoftVolumeEncryption" -Class "Win32_EncryptableVolume" 12 | foreach ($Volume in $EncryptedVolumes) { 13 | if ($Volume.DriveLetter -like $env:SystemDrive) { 14 | if ($Volume.EncryptionMethod -ge 1) { 15 | $OSDriveEncrypted = $true 16 | } 17 | } 18 | } 19 | 20 | # Set task sequence variable 21 | try { 22 | $TSEnvironment.Value("OSDBitLockerEncrypted") = "$($OSDriveEncrypted)" 23 | } 24 | catch [System.Exception] { 25 | Write-Warning -Message "An error occured while setting task sequence variable. Error message: $($_.Exception.Message)" ; exit 1 26 | } -------------------------------------------------------------------------------- /Console Extension/CreateSoftwareUpdateGroup/CreateSoftwareUpdateGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | DefaultHomeTab 4 | ContextMenu 5 | 6 | 7 | AdminUI.CollectionProperty.dll 8 | Microsoft.ConfigurationManagement.AdminConsole.CollectionProperty.Properties.Resources.resources 9 | 10 | 11 | 12 | AdminUI.UIResources.dll 13 | Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources 14 | 15 | SUM_Update 16 | 17 | 18 | "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 19 | -WindowStyle Hidden -ExecutionPolicy ByPass -File #PATH# -SiteServer #SERVER# 20 | 21 | -------------------------------------------------------------------------------- /Modules/CMOperations/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 JordanTheITGuy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Device Collection/Rename-CMCollections.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param( 3 | [parameter(Mandatory=$true)] 4 | [string]$SiteServer, 5 | [parameter(Mandatory=$true)] 6 | [string]$SiteCode, 7 | [parameter(Mandatory=$true)] 8 | [int]$CollectionType, 9 | [parameter(Mandatory=$true)] 10 | [string]$SearchFor, 11 | [parameter(Mandatory=$true)] 12 | [string]$ReplaceWith, 13 | [parameter(Mandatory=$false)] 14 | [switch]$WhatIf 15 | ) 16 | Process { 17 | $Collections = Get-WmiObject -Class SMS_Collection -Namespace "root\SMS\site_$($SiteCode)" -ComputerName "$($SiteServer)" | Where-Object { ($_.CollectionType -eq $CollectionType) -and ($_.Name -like "*$($SearchFor)*") } 18 | $Collections | ForEach-Object { 19 | if ($WhatIf -eq $true) { 20 | Write-Output "Collection to rename: $($_.Name)" 21 | } 22 | elseif ($WhatIf -ne $true) { 23 | Write-Output "Current collection name: $($_.Name)" 24 | Write-Output "New collection name: $($_.Name -replace "$($SearchFor)","$($ReplaceWith)")`n" 25 | $_.Name = $_.Name -replace "$($SearchFor)","$($ReplaceWith)" 26 | $_.Put() | Out-Null 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Console Extension/GetMaintenanceWindows/MW.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ContextMenu 4 | 5 | 6 | AdminUI.CollectionProperty.dll 7 | Microsoft.ConfigurationManagement.AdminConsole.CollectionProperty.Properties.Resources.resources 8 | 9 | 10 | 11 | AdminUI.UIResources.dll 12 | Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources 13 | 14 | Information 15 | 16 | 17 | "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 18 | -windowstyle hidden -executionpolicy bypass -file "C:\Scripts\Get-MaintenanceWindows.ps1" -SiteServer "##SUB:__Server##" -SiteCode "##SUB:SiteCode##" -ResourceID "##SUB:ResourceID##" 19 | 20 | -------------------------------------------------------------------------------- /Console Extension/DellWarranty/3.0/DellWarranty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | DefaultHomeTab 4 | ContextMenu 5 | 6 | 7 | AdminUI.CollectionProperty.dll 8 | Microsoft.ConfigurationManagement.AdminConsole.CollectionProperty.Properties.Resources.resources 9 | 10 | 11 | 12 | AdminUI.UIResources.dll 13 | Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources 14 | 15 | Information 16 | 17 | 18 | "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" 19 | -sta -WindowStyle Hidden -ExecutionPolicy ByPass -File "C:\Scripts\DellWarranty\Invoke-DellWarrantyTool_3.0.ps1" -SiteServer ##SUB:__Server## -APIKey YOURAPIKEY -DeviceName ##SUB:Name## -ResourceID ##SUB:ResourceID## 20 | 21 | -------------------------------------------------------------------------------- /Site Administration/Set-CMDiscoveryMethodADGroupScope.ps1: -------------------------------------------------------------------------------- 1 | # Import Configuration Manager module 2 | Import-Module -Name ConfigurationManager 3 | 4 | # Set location to the ConfigMgr PSDrive 5 | Set-Location -Path P01: 6 | 7 | # Define variables 8 | $SearchFilter = "Groups" 9 | $SearchBase = "OU=Contoso,DC=contoso,DC=com" 10 | 11 | # Get distinguished names for eligible OU's 12 | $OUDistinguishedNames = Get-ADOrganizationalUnit -Filter "Name -like '$($SearchFilter)'" -SearchBase $SearchBase | Select-Object -ExpandProperty DistinguishedName 13 | 14 | # Construct array list 15 | $ADGroupDiscoveryList = New-Object -TypeName System.Collections.ArrayList 16 | 17 | # Process each discovered AD object 18 | foreach ($OUDistinguishedName in $OUDistinguishedNames) { 19 | # Determine parent OU name 20 | $OUParent = (([ADSI]"LDAP://$($OUDistinguishedName)").Parent).SubString(7) 21 | $OUParentName = Get-ADOrganizationalUnit -Identity $OUParent | Select-Object -ExpandProperty Name 22 | 23 | # Create new ADGroupDiscoveryScope object and add it to the array list 24 | $ADGroupDiscoveryScope = New-CMADGroupDiscoveryScope -Name $OUParentName -LdapLocation "LDAP://$($OUDistinguishedName)" -RecursiveSearch $true 25 | $ADGroupDiscoveryList.Add($ADGroupDiscoveryScope) | Out-Null 26 | 27 | } 28 | 29 | # Set the Discovery Method scope 30 | Set-CMDiscoveryMethod -ActiveDirectoryGroupDiscovery -AddGroupDiscoveryScope $ADGroupDiscoveryList -------------------------------------------------------------------------------- /Operating System Deployment/Windows Servicing/Invoke-CMDetectFirmwareMode.ps1: -------------------------------------------------------------------------------- 1 | # Load Microsoft.SMS.TSEnvironment COM object 2 | try { 3 | $TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment -ErrorAction Stop 4 | } 5 | catch [System.Exception] { 6 | Write-Warning -Message "Unable to construct Microsoft.SMS.TSEnvironment object" ; exit 1 7 | } 8 | 9 | # Load firmware type from kernel32.dll 10 | Add-Type -Language CSharp -TypeDefinition @" 11 | 12 | using System; 13 | using System.Runtime.InteropServices; 14 | 15 | public class FirmwareType 16 | { 17 | [DllImport("kernel32.dll")] 18 | static extern bool GetFirmwareType(ref uint FirmwareType); 19 | 20 | public static uint GetFirmwareType() 21 | { 22 | uint firmwaretype = 0; 23 | if (GetFirmwareType(ref firmwaretype)) 24 | return firmwaretype; 25 | else 26 | return 0; 27 | } 28 | } 29 | "@ 30 | 31 | # Determine firmware type 32 | switch ([FirmwareType]::GetFirmwareType()) { 33 | 1 { $FirmwareType = "BIOS" } 34 | 2 { $FirmwareType = "UEFI" } 35 | 0 { $FirmwareType = "Unknown" } 36 | } 37 | 38 | # Set task sequence variable 39 | try { 40 | $TSEnvironment.Value("OSDFirmwareType") = "$($FirmwareType)" 41 | } 42 | catch [System.Exception] { 43 | Write-Warning -Message "An error occured while setting task sequence variable. Error message: $($_.Exception.Message)" ; exit 1 44 | } -------------------------------------------------------------------------------- /Site Administration/Set-CMMaxMIFSize.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This function can be run against a server to set the 'Max MIF Size' registry value. 4 | .DESCRIPTION 5 | This function can be run against a server to set the 'Max MIF Size' registry value. 6 | .PARAMETER ComputerName 7 | The NetBIOS name of the computer to run the script against. 8 | .PARAMETER Size 9 | Integer value of the maximum size for MIF size that the system will handle. Specified in hex, e.g. 3200000 = 50MB. 10 | .NOTES 11 | Name: Set-MaxMIFSize 12 | Author: Nickolaj Andersen 13 | DateCreated: 2014-01-07 14 | 15 | .LINK 16 | http://www.scconfigmgr.com 17 | .EXAMPLE 18 | Set-CMMaxMIFSize -ComputerName 'SRV001' -Size 3200000 19 | 20 | Description 21 | ----------- 22 | This command will set the 'Max MIF Size' DWORD value in 'HKLM\SOFTWARE\Microsoft\SMS\Components\SMS_INVENTORY_DATA_LOADER'. 23 | 24 | #> 25 | [CmdletBinding()] 26 | param( 27 | [ValidateScript({Test-Connection -ComputerName $_ -Count 1})] 28 | [ValidateNotNull()] 29 | [parameter(Mandatory=$true,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)] 30 | $ComputerName, 31 | [ValidateNotNull()] 32 | [parameter(Mandatory=$true)] 33 | [int]$Size 34 | ) 35 | Process { 36 | try { 37 | Invoke-Command -ComputerName $ComputerName -ScriptBlock { 38 | param( 39 | $Size, 40 | $ComputerName 41 | ) 42 | $Key = "SOFTWARE\Microsoft\SMS\Components\SMS_INVENTORY_DATA_LOADER" 43 | $BaseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName) 44 | $SubKey = $BaseKey.OpenSubkey($Key,$true) 45 | $SubKey.SetValue('Max MIF Size',$Size,[Microsoft.Win32.RegistryValueKind]::DWORD) 46 | } -ArgumentList ($Size,$ComputerName) 47 | } 48 | catch { 49 | Write-Output $_.Exception.Message 50 | } 51 | } -------------------------------------------------------------------------------- /Console Extension/DellWarranty/3.0/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |