Automation

 View Only
  • 1.  Find VM Guest with Logging Disabled and Enable

    Posted Feb 14, 2014 06:56 AM

    Hi All,

    Just finished a support call with VMware and unfortunately the vmware.log wasn't updated due the logging being disabled.

    I found random VMs with this issues, there was probably a template with this parameter which got deployed several times.

    .

    I need a way to scan all guests for this parameter and cheange the value to true, any help would be appreciated



  • 2.  RE: Find VM Guest with Logging Disabled and Enable



  • 3.  RE: Find VM Guest with Logging Disabled and Enable
    Best Answer

    Posted Feb 14, 2014 07:34 AM

    And with this line you can scan what the setting is on your VMs

    Get-VM | Select Name, @{N="Logging Enabled";E={$_.ExtensionData.Config.Flags.enableLogging}}


  • 4.  RE: Find VM Guest with Logging Disabled and Enable

    Posted Feb 18, 2014 06:42 AM

    Hi Luc,

    Thanks, can help filter out enableLogging -eq TRUE then I can output that to CSV using Export-csv, then if its not too much trouble set guest VM eq FALSE to TRUE ?



  • 5.  RE: Find VM Guest with Logging Disabled and Enable

    Posted Feb 18, 2014 07:54 AM

    You can use my function from Virtual Machine logging to enable logging.

    Something like this

    Get-VM |
    Where {!$_.ExtensionData.Config.Flags.enableLogging} | %{
     
    Set-VMLogging -VM $_ -Logging:$true
    }

    To report on the VM that have logging enabled, you can do something like this

    Get-VM |
    Where {$_.ExtensionData.Config.Flags.enableLogging} |
    Select Name, @{N="Logging Enabled";E={$_.ExtensionData.Config.Flags.enableLogging}} |
    Export-Csv report.csv -NoTypeInformation -UseCulture


  • 6.  RE: Find VM Guest with Logging Disabled and Enable

    Posted Feb 18, 2014 11:00 PM

    Hi Luc,

    That's great, is there anyway to report on guest with logging disabled rather than enabled ?



  • 7.  RE: Find VM Guest with Logging Disabled and Enable

    Posted Feb 19, 2014 05:58 AM

    Sure, change this line

    Where {$_.ExtensionData.Config.Flags.enableLogging} |


    to

    Where {!$_.ExtensionData.Config.Flags.enableLogging} |


    The ! negates the Boolean that follows.



  • 8.  RE: Find VM Guest with Logging Disabled and Enable

    Posted Sep 09, 2016 09:47 AM

    I tried by keeping "!" still report is filled up with logging enabled VMs, without "!" and with both reports VMs are same. can you please suggest on it