Solved

PowerCLI Script used to Collect Host Logs

Posted on 2016-10-24
1
44 Views
1 Endorsement
Last Modified: 2016-10-25
I am attempting to run the following simple PowerCLI script to collect host logs.

code…

Connect-VIServer myviserver
$esx = Get-VMHost myhost
$log = Get-Log -Key “vmkernel” -VMhost $esx
$log.entries > c:\logs.txt


When I run the script an error message is generated.

It reports that the Connect-VIServer command is not recognized as the name of a cmdlet.

Any ideas why this error message in being presented.

Thanks,

Lipotech
1
Comment
Question by:lipotech
1 Comment
 
LVL 117

Accepted Solution

by:
Andrew Hancock (VMware vExpert / EE MVE) earned 500 total points
Comment Utility
You've not added the Snapin... or not running VMware vSphere PowerCLI, e.g just running Powershell.

try this at the start of your Script

Add-PSSnapin "VMware.VimAutomation.Core" | Out-Null

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

It Is not possible to enable LLDP in vSwitch(at least is not supported by VMware), so in this article we will enable this, and also go trough how to enabled CDP and how to get this information in vSwitches and also in vDS.
When we have a dead host and we lose all connections to the ESXi, and we need to find a way to move all VMs from that dead ESXi host.
Teach the user how to install vSphere Update Manager  Console to Windows system:  Install vSphere Update Manager: Configure vSphere Update Manager plug-in in vSphere Client: Verify vSphere Update Manager settings in vSphere Client:
Teach the user how to use vSphere Update Manager to update the VMware Tools and virtual machine hardware version Open vSphere Client: Review manual processes for updating VMware Tools and virtual hardware versions: Create a new baseline group in vSp…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now