Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update CB #14277

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ DscResourcesToExport = @(
'RegisterTaskScheduler',
'DownloadSCCM',
'DownloadAndInstallODBC',
'DownloadAndInstallvcredist',
'WaitForExtendSchemaFile',
'SetAutomaticManagedPageFile',
'ChangeServices',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
12 changes: 6 additions & 6 deletions application-workloads/sccm/sccm-currentbranch/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -253,7 +253,7 @@
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-05-01",
"apiVersion": "2022-07-01",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
Expand All @@ -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",
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Loading