PENDINGTask sequence script failing to change drive letter

S

sjmckeeman

New Member
1
0
1
Running a server build task sequence in SCCM and encountering the following error when a configuration script runs to assign a different drive letter to one of the drives.
命令运行的脚本:

$LocalDataDrive = "E"
$dataDrive = Get-Volume | Where-Object {$_.FileSystemLabel -eq "Data"}
if($dataDrive){
Write-Output " DEBUG: Change Data drive letter to: $LocalDataDrive"
$dataDriveLetter = $dataDrive.DriveLetter
Get-CimInstance -Class Win32_Volume -Filter "DriveLetter = '${dataDriveLetter}:'" | Set-CimInstance -Arguments @{DriveLetter="${LocalDataDrive}:"}
}

The error being logged:

PS>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 "
>> TerminatingError(Set-CimInstance): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Not supported "
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Not supported
Set-CimInstance : Not supported
At D:\_SMSTaskSequence\Packages\A01002CB\HPE-New-StoreHost.ps1:111 char:89
+ ... etter}:'" | Set-CimInstance -Arguments @{DriveLetter="${LocalDataDriv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (Win32_Volume: D...4-adba-0529...):CimInstance) [Set-CimInstance], CimEx
ception
+ FullyQualifiedErrorId : HRESULT 0x8004100c,Microsoft.Management.Infrastructure.CimCmdlets.SetCimInstanceCommand
Sometimes the error does not even log, and the last line will be the write-output in the script above.
Either way, on the OSD screen the task will hang, reboot, and the sequence does not resume for the remaining steps.
This same task previously worked on the same servers (HPE ML110s in RAID config, Server 2019 and Server 2022). The same task still does work on our older Lenovo servers (single disk, Server 2012R2).
Verified running the script manually on the server does assign the correct drive letter, so it is not an issue with the commands.

I have also tried a couple different methods of changing the drive letter, but it still either hangs or errors.