VMware Cloud Community
bubzie
Contributor
Contributor

auto exporting diagnostic data from VC

I am trying to create script in which I'll catch the problem occurence with (if) then export out VC diagnostic bundle, everything is ready, with exception exporting diagnostic data from VC part,

I tried to work with get-log but it seems does not have an option to collect entire VC logs and export out as zip, I also tried using method from VI SDK, but I am a bit at a loss at this point with

diagnosticManager -> GenerateLogBundles_Task (method)

any help is appreciated, thanks!

0 Kudos
6 Replies
halr9000
Commander
Commander

That cmdlet has a second parameter set which is triggered by adding the Bundle boolean. See this table:

   ParameterSet: logSet

Name         Type       IsMandatory Pipeline
----         ----       ----------- --------
Key          String[]          True     True
VMHost       VMHost[]         False     True
StartLineNum Int32            False    False
NumLines     Int32            False    False
Server       VIServer[]       False    False


   ParameterSet: logBundleSet

Name            Type       IsMandatory Pipeline
----            ----       ----------- --------
VMHost          VMHost[]         False     True
Bundle          Boolean          False    False
DestinationPath String            True    False
Server          VIServer[]       False    False
RunAsync        Boolean          False    False

You use it like so (after connecting to the log source, e.g. vc or esx):

get-log -bundle:$true -destinationpath c:\logs -runasync






[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
bubzie
Contributor
Contributor

halr9000, Arigato Tres-mucho!!! I was hitting my head for few hours...

0 Kudos
halr9000
Commander
Commander

De nada papel nein borscht?




[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
bubzie
Contributor
Contributor

halr9000, forgot to ask, in addition if one wants to specify hosts (within cluster), datacenter etc, what would be the parameterSet to specify? Thanks.

0 Kudos
halr9000
Commander
Commander

If you look at my table, you'll see the VMHost param accepts values on the pipeline. Therefore, what I'd do is something like this:

get-cluster foo | get-vmhost | get-log ...

That would work against all hosts in the "foo" cluster.



[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum oderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
bubzie
Contributor
Contributor

Again, Mucho Arigato Schoen, halr9000!

0 Kudos