lipkau / PsIni

Work with INI files in PowerShell using hashtables
http://lipkau.github.io/PsIni
MIT License
151 stars 50 forks source link

Can't read Vmware Workstation .vmx #59

Open TheColonel2688 opened 3 years ago

TheColonel2688 commented 3 years ago

I am trying to read a Vmware .vmx file (Version 16 hardware)

So far no luck

here are the first few lines

.encoding = "windows-1252"
displayName = "Dev Master"
config.version = "8"
virtualHW.version = "18"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsisas1068"
sata0.present = "TRUE"
memsize = "12288"

When I do a Write-Host ($file | Out-String) I get this

Name                           Value
----                           -----
_                              {.encoding, displayName, config.version, virtualHW.version...}

Is the issue that .vmx files don't have sections?

nlsdg commented 1 year ago

What you're seeing is correct. The underscore character '_' is used as a placeholder sectionname when there is no section, or the lines are before the first section. You can see in the Value array that the lines have indeed been read.

If you want to get the value of a line you can do it like this: $file["_"]["scsi0.virtualDev"] This would return the value lsisas1068.