任务序列脚本更改驱动器号失败

sjmckeeman

新成员
1
0
1
在SCCM中运行服务器构建任务序列,并在运行配置脚本为其中一个驱动器分配不同的驱动器号时遇到以下错误。
从脚本运行的命令:

$LocalDataDrive = "E"
$dataDrive = Get-Volume | Where-Object{$_。FileSystemLabel -eq "Data"}
如果(dataDrive美元){
写输出" DEBUG:更改数据驱动器号为:$LocalDataDrive"
$ datadrivelletter = $dataDrive。DriveLetter
Get-CimInstance -Class Win32_Volume -Filter " drivelletter = '${LocalDataDrive}: '" | Set-CimInstance -Arguments @{drivelletter ="${LocalDataDrive}:"}

正在记录的错误:

PS>TerminatingError(set - ciminstance): "运行命令停止,因为首选项变量"ErrorActionPreference"或公共参数被设置为停止:不支持"
>> TerminatingError(set - ciminstance): "The running command stopped because The preference variable "ErrorActionPreference" or common parameter is set to Stop: Not supported "
>> TerminatingError(set - ciminstance): "The running command stopped because The preference variable "ErrorActionPreference" or common parameter is set to Stop: Not supported "
日志含义首选项变量ErrorActionPreference或公共参数设置为Stop:不支持
Set-CimInstance:不支持
在D: \ _SMSTaskSequence \ \ A01002CB \ HPE-New-StoreHost包。ps1:111字符:89
+……| Set-CimInstance -Arguments @{drivelletter ="${LocalDataDriv…"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo: NotImplemented: (Win32_Volume: D…4-adba-0529…):CimInstance) [Set-CimInstance], CimEx
ception
+ fullyqualifiederrid: HRESULT 0x8004100c,Microsoft.Management.Infrastructure.CimCmdlets.SetCimInstanceCommand
有时错误甚至不记录,最后一行将是上面脚本中的写输出。
无论哪种方式,在OSD屏幕上,任务将挂起,重新启动,并且不会恢复其余步骤的序列。
这个相同的任务以前在相同的服务器上工作(RAID配置中的HPE ml110、Server 2019和Server 2022)。同样的任务在我们的旧的联想服务器(单磁盘,Server 2012R2)上仍然有效。
经过验证,在服务器上手动运行脚本确实分配了正确的驱动器号,因此这不是命令的问题。

我还尝试了几种不同的方法来更改驱动器号,但它仍然挂起或出错。

论坛统计

线程
5347年
消息
20771年
成员
11363年
最新的成员
ywfn