0

Can you point me in the right direction, on how do convert this DISM output to Powershell objects so i can use them in my script, to filter on the results ? dism /Get-WimInfo /WimFile:"E:\_Source\OSD\x64\Windows 10 Enterprise\1607\Media\WIM\REFW10-X64-1607_04-12-2017.wim" /index:1

The out-put i get is :

Deployment Image Servicing and Management tool Version: 10.0.14393.0

Details for image : E:\_Source\OSD\x64\Windows 10 Enterprise\1607\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)

i tried with | Out-String -Stream | Select-String "Version " But with no luck..

BenDK
  • 131
  • 2
  • 7
  • I think you should use the related [Get-WindowsImage](https://learn.microsoft.com/powershell/module/dism/get-windowsimage?view=win10-ps) cmdlet instead. – iRon Dec 06 '17 at 17:36
  • already tried that, it's not as detailed as DISM get-wiminfo, i want to use the build number and languages – BenDK Dec 06 '17 at 17:38
  • `dism /Get-WimInfo /WimFile:"C:\..." /index:1 | Select-String "Version "` works for me... – iRon Dec 06 '17 at 18:16
  • Also: `dism /Get-WimInfo /WimFile:"C:\..." /index:1 | Select-String "Languages " -Context 0,1` – iRon Dec 06 '17 at 18:21
  • Wow thanks! do you know how to only get the language code, as the results come in 2 lines ? beacuse i need to pass XX-XX to a hashtable – BenDK Dec 06 '17 at 18:31

2 Answers2

0

Putting it together:

$WimFile = "E:\_Source\OSD\x64\Windows 10 Enterprise\1607\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]
iRon
  • 20,463
  • 10
  • 53
  • 79
0
$WimFile = "E:\_Source\OSD\x64\Windows 10 Enterprise\1607\Media\WIM\REFW10-X64-1607_04-12-2017.wim"
$WinInfo=Get-WindowsImage -ImagePath  $WimFile -index 1
$Version = $WinInfo.Version
$Language = $WinInfo.Languages
RPO
  • 1