如何在Azure中使用所需状态配置(DSC)在VM中安装Google chrome?

时间:2020-04-12 06:26:43

标签: azure azure-virtual-machine dsc

我正在尝试使用以下代码在蔚蓝中使用DSC安装Google Chrome。

Configuration InstallGoogleChorme
{

Import-DscResource –ModuleName 'PSDesiredStateConfiguration'

Node installChrome
    {
        #Google Chorme
         Package Chorme
         {
         Ensure = 'Present'
         Name = 'Google Chrome'
         Path = '‪C:\Users\google\Desktop\ChromeSetup.exe'
         ProductId = ''
         Arguments = '/silent /install'
        }
    }
}



InstallGoogleChorme -OutputPath C:\

Start-DscConfiguration -Path c:\ -Wait -Verbose -Force

但是无法安装并出现以下错误。

The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. + CategoryInfo : NotEnabled: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : HRESULT 0x803380e4 + PSComputerName : installChrome

任何人都可以帮助我解决问题/

2 个答案:

答案 0 :(得分:0)

通过在VM上运行“ winrm枚举winrm / config / listener”来验证winrm侦听器。 如果无法正常工作,请确保您启用了winrm并通过https监听。

答案 1 :(得分:0)

根据该错误消息,您可以尝试使用Powershell作为管理员特权将目标IP地址添加到TrustedHosts列表中。

Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'machineA,machineB'

注意:如果在Powershell上运行,上述命令可能会失败

然后运行以下命令以查看TrustedHosts列表中的计算机:

Get-Item WSMan:\localhost\Client\TrustedHosts

请参阅thisthis