Powershell ISEと標準コンソール(どちらも管理者として実行)によるDSCスクリプトの実行の違いを教えていただけますか?DSC(Desired State Configuration)
PS ISEでスクリプトを実行すると、すべて正常に動作し、DSCは2台のサーバーに適用されます。暗号化。
System.Management.Automation.RuntimeException::私はこのようなエラーメッセージを取得しています「のPowershellで実行する」で、まったく同じスクリプトを実行するときがありますが、ヌル値式のメソッドを呼び出すことはできません。 System.Management.Automation.Interpreter.EnterTryCatchFinallyInstructionでSystem.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame フレーム)で System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext、例外例外)で.Run(InterpretedFrame フレーム)を に設定します。System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame フレーム)。
のScriptBlockでライン1021、いいえ、ファイル:行1
これらのエラーは(太字)以下の行を指していない:
Configuration Config1
{
...
...
...
}
$configdata = @{
AllNodes = @(
@{
NodeName = "Server1"
PSDscAllowDomainUser = $true
CertificateFile = "$((Get-ChildItem 'E:\' | ? {$_.Name -like 'MyFolderName'}).fullname)\Server1.cer"
Thumbprint = ($Thumbs | ? {$_ -like "Server1*"}).Split("=")[1]
}
@{
NodeName = "Server2"
PSDscAllowDomainUser = $true
CertificateFile = "$((Get-ChildItem 'E:\' | ? {$_.Name -like MyFolderName'}).fullname)\Server2.cer"
Thumbprint = ($Thumbs | ? {$_ -like "Server2*"}).Split("=")[1]
}
)
}
Config1 -ConfigurationData $configdata
問題は(私が実行しているサーバー2でありますServer1上のスクリプト)。すべてのパスが正しいですが、ハッシュテーブルでそのような構文を使用できますか?
問題は、標準のPowerShellコンソールにあります.PS ISEがエラーを返さない理由は誰にも分かりますか?
あなたはPowerShellのISE対標準PowerShellコンソールでコード実行の間に別のを見ている場合は、私はあなたのPowerShellをチェックしますプロファイル。異なるプロファイルがあり、ISEと標準コンソールではpowershellが実行されます。 [プロフィールについて](https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/ise/how-to-use-profiles-in-windows-powershell-ise) –