diff --git a/application-workloads/sccm/sccm-currentbranch/DSC/DCConfiguration.zip b/application-workloads/sccm/sccm-currentbranch/DSC/DCConfiguration.zip index 7a3af0126557..1d01d39502ed 100644 Binary files a/application-workloads/sccm/sccm-currentbranch/DSC/DCConfiguration.zip and b/application-workloads/sccm/sccm-currentbranch/DSC/DCConfiguration.zip differ diff --git a/application-workloads/sccm/sccm-currentbranch/DSC/InstallCSForHierarchy.ps1 b/application-workloads/sccm/sccm-currentbranch/DSC/InstallCSForHierarchy.ps1 index 0310cc6ac91c..5e1cf68350eb 100644 --- a/application-workloads/sccm/sccm-currentbranch/DSC/InstallCSForHierarchy.ps1 +++ b/application-workloads/sccm/sccm-currentbranch/DSC/InstallCSForHierarchy.ps1 @@ -112,7 +112,7 @@ $Configuration.UpgradeSCCM.Status = 'Running' $Configuration.UpgradeSCCM.StartTime = Get-Date -format "yyyy-MM-dd HH:mm:ss" $Configuration | ConvertTo-Json | Out-File -FilePath $ConfigurationFile -Force -Start-Sleep -econds 120 +Start-Sleep -Seconds 120 $logpath = $ProvisionToolPath+"\UpgradeCMlog.txt" $SiteCode = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\SMS\Identification' -Name 'Site Code' @@ -171,6 +171,33 @@ while($DMPState -ne "Running") "Current SMS_DMP_DOWNLOADER state is : $DMPState " | Out-File -Append $logpath +"[$(Get-Date -format "MM/dd/yyyy HH:mm:ss")] Trying to enable CAS EnableSCCMManagedCert." | Out-File -Append $logpath + +#Configure CAS EnableSCCMManagedCert +$WmiObjectNameSpace = "root\SMS\site_$($SiteCode)" +#Get component +$wmiObject = Get-WmiObject -Namespace $WmiObjectNameSpace -class SMS_SCI_Component -Filter "ComponentName='SMS_SITE_COMPONENT_MANAGER'"| where-object {$_.SiteCode -eq $SiteCode} + +#Get embeded property +$props = $wmiObject.Props +$index = 0 +foreach($oProp in $props) +{ + if($oProp.PropertyName -eq 'IISSSLState') + { + $v = $oProp.Value + "[$(Get-Date -format "MM/dd/yyyy HH:mm:ss")] IISSSLState previous value is $v." | Out-File -Append $logpath + $oProp.Value = '1216' + $props[$index] = $oProp + } + $index++ +} + +$WmiObject.Props = $props +$wmiObject.Put() + +"[$(Get-Date -format "MM/dd/yyyy HH:mm:ss")] Set the IISSSLState 1216, you could check it manually" | Out-File -Append $logpath + #get the available update function getupdate() { diff --git a/application-workloads/sccm/sccm-currentbranch/DSC/PSConfiguration.ps1 b/application-workloads/sccm/sccm-currentbranch/DSC/PSConfiguration.ps1 index 29bf47108831..7482b092182a 100644 --- a/application-workloads/sccm/sccm-currentbranch/DSC/PSConfiguration.ps1 +++ b/application-workloads/sccm/sccm-currentbranch/DSC/PSConfiguration.ps1 @@ -73,12 +73,18 @@ DependsOn = "[InstallFeatureForSCCM]InstallFeature" } - DownloadAndInstallODBC DownloadAndInstallODBC + DownloadAndInstallvcredist DownloadAndInstallvcredist { Ensure = "Present" DependsOn = "[InstallADK]ADKInstall" } + DownloadAndInstallODBC DownloadAndInstallODBC + { + Ensure = "Present" + DependsOn = "[DownloadAndInstallvcredist]DownloadAndInstallvcredist" + } + if($Configuration -eq "Standalone") { DownloadSCCM DownLoadSCCM diff --git a/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psd1 b/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psd1 index e14bb3955779..b2a77e1eb258 100644 --- a/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psd1 +++ b/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psd1 @@ -21,6 +21,7 @@ DscResourcesToExport = @( 'RegisterTaskScheduler', 'DownloadSCCM', 'DownloadAndInstallODBC', + 'DownloadAndInstallvcredist', 'WaitForExtendSchemaFile', 'SetAutomaticManagedPageFile', 'ChangeServices', diff --git a/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psm1 b/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psm1 index d926a17ebc27..740d1f8ee3d1 100644 --- a/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psm1 +++ b/application-workloads/sccm/sccm-currentbranch/DSC/TemplateHelpDSC/TemplateHelpDSC.psm1 @@ -1926,3 +1926,64 @@ class InstallCA } } + +[DscResource()] +class DownloadAndInstallvcredist +{ + [DscProperty(key)] + [Ensure] $Ensure + + [void] Set() + { + $vcredist64Path = "C:\VC_redist.x64.exe" + $vcredist86Path = "C:\VC_redist.x86.exe" + + Write-Verbose "Downloading Microsoft Visual C++ Redistributable(x64) installation source..." + $vcredistUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe" + $WebClient = New-Object System.Net.WebClient + $WebClient.DownloadFile($vcredistUrl,$vcredist64Path) + + Write-Verbose "installing Microsoft Visual C++ Redistributable(x64)..." + Start-Process -FilePath $vcredist64Path -ArgumentList ('/install', '/quiet') -Wait + Write-Verbose "Microsoft Visual C++ Redistributable(x64) installed Successfully!" + + Write-Verbose "Downloading Microsoft Visual C++ Redistributable(x86) installation source..." + $vcredistUrl = "https://aka.ms/vs/17/release/vc_redist.x86.exe" + $WebClient = New-Object System.Net.WebClient + $WebClient.DownloadFile($vcredistUrl,$vcredist86Path) + + Write-Verbose "installing Microsoft Visual C++ Redistributable(x86)..." + Start-Process -FilePath $vcredist86Path -ArgumentList ('/install', '/quiet') -Wait + Write-Verbose "Microsoft Visual C++ Redistributable(x86) installed Successfully!" + + + } + + [bool] Test() + { + #This minorVersion is the installed Microsoft Visual C++ Redistributable version. + $minorVersion = [version]'14.34.0.0' + + $key = [Microsoft.Win32.RegistryKey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, [Microsoft.Win32.RegistryView]::Registry32) + $sub64Key = $key.OpenSubKey("SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64") + $sub86Key = $key.OpenSubKey("SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86") + if($sub64Key -and $sub86Key) + { + $vcredist64Version = $sub64Key.GetValue('Version') + $vcredist86Version = $sub86Key.GetValue('Version') + if(($vcredist64Version -ne $null) -and ($vcredist86Version -ne $null)) + { + $vcredist64Version = $vcredist64Version -replace '^v','' + $vcredist86Version = $vcredist86Version -replace '^v','' + return (([version]$vcredist64Version -ge $minorVersion) -and ([version]$vcredist86Version -ge $minorVersion)) + } + } + return $false + + } + + [DownloadAndInstallvcredist] Get() + { + return $this + } +} diff --git a/application-workloads/sccm/sccm-currentbranch/azuredeploy.json b/application-workloads/sccm/sccm-currentbranch/azuredeploy.json index 6f011f9f8dc3..564799509890 100644 --- a/application-workloads/sccm/sccm-currentbranch/azuredeploy.json +++ b/application-workloads/sccm/sccm-currentbranch/azuredeploy.json @@ -159,7 +159,7 @@ "resources": [ { "type": "Microsoft.Compute/virtualMachines", - "apiVersion": "2019-12-01", + "apiVersion": "2022-11-01", "name": "[concat(toLower(parameters('prefix')),toLower(if(less(copyIndex(),length(variables('vmInfo'))),variables('vmInfo')[variables('vmRole')[copyIndex()]].name,if(greaterOrEquals(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo')))),variables('clientInfo')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))][variables('clientRole')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))]].name,variables('siteInfo')[variables('siteRole')[sub(copyIndex(),length(variables('vmInfo')))]].name))))]", "location": "[parameters('location')]", "copy": { @@ -211,7 +211,7 @@ }, { "type": "Microsoft.Compute/virtualMachines/extensions", - "apiVersion": "2019-12-01", + "apiVersion": "2022-11-01", "name": "[concat(toLower(parameters('prefix')),toLower(if(less(copyIndex(),length(variables('vmInfo'))),variables('vmInfo')[variables('vmRole')[copyIndex()]].name,if(greaterOrEquals(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo')))),variables('clientInfo')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))][variables('clientRole')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))]].name,variables('siteInfo')[variables('siteRole')[sub(copyIndex(),length(variables('vmInfo')))]].name))), '/WorkFlow')]", "location": "[parameters('location')]", "copy": { @@ -253,7 +253,7 @@ }, { "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2020-05-01", + "apiVersion": "2022-07-01", "name": "[variables('virtualNetworkName')]", "location": "[parameters('location')]", "properties": { @@ -275,7 +275,7 @@ { "type": "Microsoft.Network/networkInterfaces", "name": "[concat(toLower(parameters('prefix')),toLower(if(less(copyIndex(),length(variables('vmInfo'))),variables('vmInfo')[variables('vmRole')[copyIndex()]].name,if(greaterOrEquals(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo')))),variables('clientInfo')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))][variables('clientRole')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))]].name,variables('siteInfo')[variables('siteRole')[sub(copyIndex(),length(variables('vmInfo')))]].name))), '-ni')]", - "apiVersion": "2020-05-01", + "apiVersion": "2022-07-01", "location": "[parameters('location')]", "copy": { "name": "nicopy", @@ -309,7 +309,7 @@ }, { "type": "Microsoft.Network/publicIpAddresses", - "apiVersion": "2020-05-01", + "apiVersion": "2022-07-01", "name": "[concat(toLower(parameters('prefix')),toLower(if(less(copyIndex(),length(variables('vmInfo'))),variables('vmInfo')[variables('vmRole')[copyIndex()]].name,if(greaterOrEquals(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo')))),variables('clientInfo')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))][variables('clientRole')[sub(copyIndex(),add(length(variables('vmInfo')),length(variables('siteInfo'))))]].name,variables('siteInfo')[variables('siteRole')[sub(copyIndex(),length(variables('vmInfo')))]].name))), '-ip')]", "location": "[parameters('location')]", "copy": { @@ -322,7 +322,7 @@ }, { "type": "Microsoft.Network/networkSecurityGroups", - "apiVersion": "2020-05-01", + "apiVersion": "2022-07-01", "name": "[concat(toLower(parameters('prefix')), '-nsg')]", "location": "[parameters('location')]", "properties": { diff --git a/application-workloads/sccm/sccm-currentbranch/metadata.json b/application-workloads/sccm/sccm-currentbranch/metadata.json index 733716599abe..76e7659d3d9e 100644 --- a/application-workloads/sccm/sccm-currentbranch/metadata.json +++ b/application-workloads/sccm/sccm-currentbranch/metadata.json @@ -5,5 +5,5 @@ "description": "This template creates new Azure VMs based on which configuration you choose. It configures a new AD domain controler, a new hierarchy/standalone bench with SQL Server, a remote site system server with Management Point and Distribution Point and clients. ", "summary": "This template installs Microsoft Endpoint Configuration Manager current branch in Azure", "githubUsername": "YuanhengYang", - "dateUpdated": "2023-11-09" + "dateUpdated": "2024-12-25" } \ No newline at end of file