Powershell阻止确认

Posted 钢闸门的笔记收藏册

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Powershell阻止确认相关的知识,希望对你有一定的参考价值。

要阻止弹出确认提示,需要设置-Confirm为false,

new-VM -Name $hostname -Template $template -VMHost 10.11.31.5 -OSCustomizationspec TestLinux -Confirm:$false

 获得当前确认级别

$ConfirmPreference

查看确认级别($ConfirmPreference)支持的选项,类型为枚举

[ENUM]::GetNames($ConfirmPreference.GetType())

 设置确认级别

$ConfirmPreference="None"

 

以上是关于Powershell阻止确认的主要内容,如果未能解决你的问题,请参考以下文章