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
$RBAC_CollectionQuery = @" | |
declare @SID varbinary(39), @Token nvarchar(max), @UserID nvarchar(max) | |
SET @SID = SUSER_SID() | |
Set @Token = 'S-1-5-21-' | |
+CAST(CAST(CAST(REVERSE(CONVERT(binary(4),'0x'+sys.fn_varbintohexsubstring(0,@SID,13,4),1)) as varbinary(4)) as bigint) as varchar(10)) | |
+'-'+CAST(CAST(CAST(REVERSE(CONVERT(binary(4),'0x'+sys.fn_varbintohexsubstring(0,@SID,17,4),1)) as varbinary(4)) as bigint) as varchar(10)) | |
+'-'+CAST(CAST(CAST(REVERSE(CONVERT(binary(4),'0x'+sys.fn_varbintohexsubstring(0,@SID,21,4),1)) as varbinary(4)) as bigint) as varchar(10)) | |
+'-'+CAST(CAST(CAST(REVERSE(CONVERT(binary(4),'0x'+sys.fn_varbintohexsubstring(0,@SID,25,4),1)) as varbinary(4)) as bigint) as varchar(10)) | |
set @UserID = dbo.fn_rbac_GetAdminIDsfromUserSIDs(@Token) | |
Select |
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 create global conditions if they don't exist and find OS GC | |
#region GC Office Product function | |
function Get-CMOfficeGlobalCondition { | |
[CmdletBinding()] | |
param ( | |
[parameter(Mandatory = $true)] | |
[validateset('Project Professional', 'Project Standard', 'Project', 'Visio Professional', 'Visio Standard', 'Visio')] | |
[string]$Application | |
) | |
$GC_Name = [string]::Format('Condition Detection - Microsoft {0}', $Application) |
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
$appName = 'Office 365 - Visio Volume and Project Volume' | |
$New365DynamicAppSplat = @{ | |
AppRoot = '\\contoso.com\DFS\CM\Applications\Office365\O365-DynamicInstall' | |
ProjectLicense = 'Volume' | |
ApplicationName = $AppName | |
SMSProvider = 'SCCM' | |
VisioLicense = 'Volume' | |
Company = 'Contoso' | |
Bitness = 'x64' | |
UpdateChannel = 'Semi-Annual' |
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
$getWmiObjectSplat = @{ | |
Query = "SELECT LocalizedDisplayName FROM SMS_SoftwareUpdate WHERE LocalizedDisplayName LIKE 'Office 365 Client Update - $Channel%$Bitness%' AND IsDeployed = '1' AND IsLatest = '1'" | |
ComputerName = $SMSProvider | |
Namespace = "root\sms\site_$SiteCode" | |
} | |
$365Patches = Get-WmiObject @getWmiObjectSplat | Select-Object -ExpandProperty LocalizedDisplayName | |
if ($365Patches.Count -gt 0) { | |
$Regex = "\(Build ([0-9]+\.[0-9]+)\)" | |
[double[]]$Builds = foreach ($Value in $365Patches) { | |
[regex]::Match($Value, $Regex).Groups[1].Value |
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 determine which Requirements we need to add for this deployment type based on ProductIDs | |
$Requirements = [System.Collections.ArrayList]::new() | |
switch -Regex ($DT.ProductIDs) { | |
'^VisioPro(X|2019)Volume$' { | |
$null = $Requirements.Add($VisPro_Rule) | |
} | |
'^VisioStd(X|2019)Volume$' { | |
$null = $Requirements.Add($VisStandard_Rule) | |
} | |
'^VisioProRetail$' { |
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 |
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
$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
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
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' |
OlderNewer