- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 -Name DS -PSProvider VimDatastore -Root "\" | Out-Null
Copy-DatastoreItem -Item "DS:$vmxPath" -Destination $tgtFolder
Remove-PSDrive -Name DS -Confirm:$false
}
Get-ChildItem -Path $tgtFolder -Filter "*.vmx" |
Where {Get-Content -Path $_.FullName | Select-String -Pattern $tgtString} |
Select Name
It will display the name of each VMX file in which the string 'scsi0:1.writeThrough="True"' is found.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference