Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230200

Re: script to check a setting in a vmx file for specific entry

$
0
0

Sure, try something like this

 

$vmName="VM*"
$tgtFolder="C:\Temp\VMX\"
$tgtString='scsi0:1.writeThrough = "true"'

Get-VM-Name$vmName|%{
 
$dsName,$vmxPath=$_.ExtensionData.Config.Files.VmPathName.Split()
 
$dsName=$dsName.Trim('[]')
 
$ds=Get-Datastore-Name$dsName
 
New-PSDrive-Location$ds-NameDS-PSProviderVimDatastore-Root"\"|Out-Null
 
Copy-DatastoreItem-Item"DS:$vmxPath"-Destination$tgtFolder
 
Remove-PSDrive-NameDS-Confirm:$false
}

Get-ChildItem-Path$tgtFolder-Filter"*.vmx"|
Where {Get-Content-Path$_.FullName|Select-String-Pattern$tgtString} |
SelectName

It will display the name of each VMX file in which the string 'scsi0:1.writeThrough="True"'  is found.


Viewing all articles
Browse latest Browse all 230200

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>