将 DISM 输出转换为 PS 个对象
Convert DISM output to PS objects
关于如何将此 DISM 输出转换为 Powershell 对象以便我可以在我的脚本中使用它们来过滤结果,你能给我指出正确的方向吗?
dism /Get-WimInfo /WimFile:"E:\_Source\OSD\x64\Windows 10 Enterprise07\Media\WIM\REFW10-X64-1607_04-12-2017.wim" /index:1
我得到的输出是:
Deployment Image Servicing and Management tool Version: 10.0.14393.0
Details for image : E:\_Source\OSD\x64\Windows 10 Enterprise07\Media\WIM\REFW10-X64-1607_04-12-2017.wim
Index : 1 Name : REFW10-X64EN-01EDrive
Description : Build Windows 10 Enterprise x64 en-US
Size : 18.500.052.305 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.16299
ServicePack Build : 15
ServicePack Level : 64
Edition : Enterprise
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 24025
Files : 112737
Created : 24-11-2017 - 01:40:49
Modified : 24-11-2017 - 01:40:51
Languages : en-US (Default)
我试过 | Out-String -Stream | Select-String "Version "
但是没有运气..
放在一起:
$WimFile = "E:\_Source\OSD\x64\Windows 10 Enterprise07\Media\WIM\REFW10-X64-1607_04-12-2017.wim"
$Version = (dism /Get-WimInfo /WimFile:$WimFile /index:1 | Select-String "Version ").ToString().Split(":")[1].Trim()
$Language = ((dism /Get-WimInfo /WimFile:$WimFile /index:1 | Select-String "Languages " -Context 0,1).ToString() -Split "\s\(Default\)" -Split "\s")[-2]
关于如何将此 DISM 输出转换为 Powershell 对象以便我可以在我的脚本中使用它们来过滤结果,你能给我指出正确的方向吗?
dism /Get-WimInfo /WimFile:"E:\_Source\OSD\x64\Windows 10 Enterprise07\Media\WIM\REFW10-X64-1607_04-12-2017.wim" /index:1
我得到的输出是:
Deployment Image Servicing and Management tool Version: 10.0.14393.0
Details for image : E:\_Source\OSD\x64\Windows 10 Enterprise07\Media\WIM\REFW10-X64-1607_04-12-2017.wim
Index : 1 Name : REFW10-X64EN-01EDrive
Description : Build Windows 10 Enterprise x64 en-US
Size : 18.500.052.305 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.16299
ServicePack Build : 15
ServicePack Level : 64
Edition : Enterprise
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 24025
Files : 112737
Created : 24-11-2017 - 01:40:49
Modified : 24-11-2017 - 01:40:51
Languages : en-US (Default)
我试过 | Out-String -Stream | Select-String "Version "
但是没有运气..
放在一起:
$WimFile = "E:\_Source\OSD\x64\Windows 10 Enterprise07\Media\WIM\REFW10-X64-1607_04-12-2017.wim"
$Version = (dism /Get-WimInfo /WimFile:$WimFile /index:1 | Select-String "Version ").ToString().Split(":")[1].Trim()
$Language = ((dism /Get-WimInfo /WimFile:$WimFile /index:1 | Select-String "Languages " -Context 0,1).ToString() -Split "\s\(Default\)" -Split "\s")[-2]