自定义镜像,数据盘盘符变化,这种可能是san policy不是onlineall导致的

2023-05-11 18:46:10 浏览数 (1)

比如预期数据盘盘符是E,但实际成了D,E被光驱占了

这种可以通过如下脚本解决

代码语言:javascript复制
reg add "HKCUKeyboard LayoutPreload" /v "1" /d 00000409 /t REG_SZ /f 2>&1 > $null
reg add "HKCUKeyboard LayoutPreload" /v "2" /d 00000804 /t REG_SZ /f 2>&1 > $null
reg add "HKLMSYSTEMKeyboard LayoutPreload" /v "1" /d 00000409 /t REG_SZ /f 2>&1 > $null
reg add "HKLMSYSTEMKeyboard LayoutPreload" /v "2" /d 00000804 /t REG_SZ /f 2>&1 > $null
reg add "HKEY_USERS.DEFAULTKeyboard LayoutPreload" /v "1" /d 00000409 /t REG_SZ /f 2>&1 > $null
reg add "HKEY_USERS.DEFAULTKeyboard LayoutPreload" /v "2" /d 00000804 /t REG_SZ /f 2>&1 > $nul
reg add "HKLMSYSTEMCurrentControlSetControlKeyboard Layout" /v IgnoreRemoteKeyboardLayout /t REG_DWORD /d 1 /f 2>&1 > $null
reg add "HKLMSYSTEMCurrentControlSetControlKeyboard Layouts" /v IgnoreRemoteKeyboardLayout /t REG_DWORD /d 1 /f 2>&1 > $null

"SAN Policy=OnlineAll" | diskpart 2>&1 > $null

$curDrive=Get-Disk | ?{$_.Number -eq 1} | Get-Partition | Select-Object -ExpandProperty DriveLetter
if($curDrive -ne "E"){
Get-WmiObject -Class Win32_volume -Filter 'DriveType=5' |Set-WmiInstance -Arguments @{DriveLetter='Z:'} 2>&1 >$null
Set-Partition -DriveLetter $curDrive -NewDriveLetter E 2>$null
Get-WmiObject -Class Win32_volume -Filter 'DriveType=5' |Set-WmiInstance -Arguments @{DriveLetter='D:'} 2>&1 >$null
}

0 人点赞