VMware Cloud Community
Zadnak
Contributor
Contributor

Compliance Hardening

Hi,

I'm trying to use PowerCLI to harden our VM's for compliance. The VM's that need to be hardened are in a csv file. I tried the following command:

Import-CSV c:\temp\test.csv | New-AdvancedSetting -Name "tools.guestlib.enableHostInfo" -value $false

but it errors with parameters not matching that take pipe for input.

Help? PowerCLI is something I rarely use.

Thanks!

0 Kudos
3 Replies
LucD
Leadership
Leadership

Try like this

Get-VM -Name (Import-CSV c:\temp\test.csv) | New-AdvancedSetting -Name "tools.guestlib.enableHostInfo" -value $false


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

0 Kudos
Zadnak
Contributor
Contributor

I tried that too. I get the following error:

Get-VM : 3/27/2014 12:33:59 PM    Get-VM        VM with name '@{2008R2 (2cf8c56

4-f543-4a8a-b1b2-a59f378e28d5)                                  =CS0004 }' was

not found using the specified filter(s).

At line:1 char:7

+ Get-VM <<<<  -Name (Import-CSV c:\temp\test.csv)

    + CategoryInfo          : ObjectNotFound: (:) [Get-VM], VimException

    + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimA

   utomation.ViCore.Cmdlets.Commands.GetVM

0 Kudos
LucD
Leadership
Leadership

That is most probably caused by the layout of your CSV file.

Can you show what is in the CSV file ?


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

0 Kudos