Solved

PowerCLI Script used to Collect Host Logs

Posted on 2016-10-24
1
86 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 120

Accepted Solution

by:
Andrew Hancock (VMware vExpert / EE MVE^2) earned 500 total points
ID: 41857571
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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Power Action 2 46
Psexec with Powershell to install critical patches 5 75
Backup Options in vSphere 6.x 1 38
VM Workstation / internet? 2 23
When converting a physical machine to a virtual machine using VMware vCenter Converter Standalone or vCenter Converter Enterprise, if an adapter type is not selected during the initial customization the resulting virtual machine may contain an IDE d…
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …
Teach the user how to install and configure the vCenter Orchestrator virtual appliance Open vSphere Web Client: Deploy vCenter Orchestrator virtual appliance OVA file: Verify vCenter Orchestrator virtual appliance boots successfully: Connect to the …

751 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