Skip to content

Instantly share code, notes, and snippets.

View CodyMathis123's full-sized avatar
🦖
Working from home

Cody Mathis CodyMathis123

🦖
Working from home
View GitHub Profile
#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$' {
$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
$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'
#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)
$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