powershell DSC推动CIMSession
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell DSC推动CIMSession相关的知识,希望对你有一定的参考价值。
#-------------------------------------------------------
#specify test device details and load up credentials
$s1 = "SERVER1"
$creds = Get-Credential -Message "Enter Credentials"
#-------------------------------------------------------
#create remote CIM session with the appropriate options for your environment
$sop = New-CimSessionOption –UseSSL -SkipCACheck -SkipCNCheck -SkipRevocationCheck
$cim = New-CimSession -ComputerName $s1 -Credential $creds -SessionOption $sop
#-------------------------------------------------------
#push the configuration
Start-DSCConfiguration -CimSession $cim -Path C:\DSC\Test -Wait -Verbose -Force
#*******************************************************
#-------------------------------------------------------
#establish new session to second server and repeat process
$s2 = "SERVER2"
#-------------------------------------------------------
#create remote CIM session with the appropriate options for your environment
$cim = New-CimSession -ComputerName $s2 -Credential $creds -SessionOption $sop
#-------------------------------------------------------
#push the configuration
Start-DSCConfiguration -CimSession $cim -Path C:\DSC\Test -Wait -Verbose -Force
#-------------------------------------------------------
以上是关于powershell DSC推动CIMSession的主要内容,如果未能解决你的问题,请参考以下文章
PowerShell DSC学习资料
powershell 示例DSC
powershell DSC复制并使用模块运行本地
powershell 演示Dsc101.ps1
MCSA2016_004 - PowerShell DSC -
11.PowerShell DSC之安装PowerShell Module