VMware Cloud Community
Obie38
Contributor
Contributor
Jump to solution

List scratch locations with powercli

Hi,

i'm trying to script with powercli but i'm not very good Smiley Happy

My aim is to list for all my esx servers the location of scratch and to link this information with the

datastore name if possible. I want an html file with the informations:

Get-VMHost -Name * | Get-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation"

Get-VMHost -Name * | Get-VMHostAdvancedConfiguration -Name "ScratchConfig.CurrentScratchLocation" |

ConvertTo-HTML | Out-File C:\myfile.html

I fail to script it.

If someone can help me.... Smiley Happy

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

$scratch="ScratchConfig.ConfiguredScratchLocation"
&{foreach($esx in Get-VMHost){
 
Get-AdvancedSetting -Entity $esx -Name $scratch |
 
Select @{N="ESXi";E={$esx.Name}},Value
}}
| ConvertTo-Html | Out-File C:\report.html

Invoke-Item c:\report.html


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

$scratch="ScratchConfig.ConfiguredScratchLocation"
&{foreach($esx in Get-VMHost){
 
Get-AdvancedSetting -Entity $esx -Name $scratch |
 
Select @{N="ESXi";E={$esx.Name}},Value
}}
| ConvertTo-Html | Out-File C:\report.html

Invoke-Item c:\report.html


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Obie38
Contributor
Contributor
Jump to solution

That's what i need

Thank you !

Smiley Happy

0 Kudos
cfizz34vmware
Enthusiast
Enthusiast
Jump to solution

Would you be able to assist in the script to purge all the data from all of the the scratch disks?  It not all, what about a particular file say called removeme.txt from all folders/subfolder located in the scratch partitions?

 

0 Kudos