This commit is contained in:
Claus Jespersen 2023-11-28 07:47:14 +01:00 коммит произвёл GitHub
Родитель 6e3b2cfad0
Коммит 55cca3b790
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 50 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,50 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)]
[string]$m365cert,
[string]$dsccertificate
)
Install-Module-NameMicrosoft365Dsc-force-AllowClobber
Update-M365DSCDependencies
Import-ModuleMicrosoft365Dsc
$location=Get-Location
$m365configcertStringBase64=$m365cert
$m365configcertByteArray=[System.Convert]::FromBase64String($m365configcertStringBase64)
[System.IO.File]::WriteAllBytes("$location/m365configcert.pfx",$m365configcertByteArray)
$m365configcert=[System.Security.Cryptography.X509Certificates.X509Certificate2]($m365configcertByteArray)
$m365configcertThumbprint=$m365configcert.Thumbprint
Import-PfxCertificate-FilePath$location/m365configcert.pfx-CertStoreLocationCert:\LocalMachine\My
$m365configcert.Dispose()
$m365configcert=$null
Remove-Item"$location/m365configcert.pfx"
$dsccertStringBase64=$dsccertificate
$dsccertByteArray=[System.Convert]::FromBase64String($dsccertStringBase64)
[System.IO.File]::WriteAllBytes("$location/dsccert.pfx",$dsccertByteArray)
$dsccert=[System.Security.Cryptography.X509Certificates.X509Certificate2]($dsccertByteArray)
$dsccertThumbprint=$dsccert.Thumbprint
Import-PfxCertificate-FilePath$location/dsccert.pfx-CertStoreLocationCert:\LocalMachine\My
$dsccert.Dispose()
$dsccert=$null
Remove-Item"$location/dsccert.pfx"
winrmquickconfig-force
ConfigurationConfigureLCM
{
param(
[Parameter(Mandatory=$True)]
[string]$dsccertThumbprint
)
Import-DscResource-ModuleNamePsDesiredStateConfiguration
nodelocalhost
{
LocalConfigurationManager
{
CertificateId=$dsccertThumbprint
}
}
}
ConfigureLCM-dsccertThumbprint$dsccertThumbprint
set-DscLocalConfigurationManager-Path$location\ConfigureLcm\-force-verbose