■ダウンロード http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli ログイン画面を経由して下記へ http://www.vmware.com/downloads/eula.do vSphere PowerCLI - installer (約91MB) Download and install an easy-to-use PowerShell interface to manage and monitor vSphere. Use Web Browser を選択してインストーラ(VMware-PowerCLI-5.0.0-435426.exe)をPCに保存。 ※PowerShellはWindows7には同梱されているのでインストール不要。 ※Windows7またはWindowsServer2008以外は下記URLからインストーラをDL http://support.microsoft.com/kb/968929 ■インストールパス C:\ProgramFiles2\VMware\Infrastructure\vSphere PowerCLI\ ■PowerCLI起動 VMware vSphere PowerCLIショートカットアイコンを普通にダブルクリックして起動
-------------------------------------------------------------
スクリプトの実行がシステムで無効になっているため、ファイル C:\ProgramFiles2\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1 を読み込めません。詳細については、「get-help about_signing」と入力してヘルプを参照してください。
発生場所 行:1 文字:2
+ . <<<< "C:\ProgramFiles2\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvir
onment.ps1"
+ CategoryInfo : 未指定: (:) []、PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
-------------------------------------------------------------
スクリプトの実行を有効化しようとしたが…。
-------------------------------------------------------------
PS C:\ProgramFiles2\VMware\Infrastructure\vSphere PowerCLI> Set-ExecutionPolicy RemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution
policy might expose you to the security risks described in the about_Execution_Policies help topic.
Do you want to change the execution policy?
[Y] はい(Y) [N] いいえ(N) [S] 中断(S) [?] ヘルプ (既定値は "Y"): Y
Set-ExecutionPolicy : レジストリ キー 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\
Microsoft.PowerShell' へのアクセスが拒否されました。
発生場所 行:1 文字:20
+ Set-ExecutionPolicy <<<< RemoteSigned
+ CategoryInfo : 未指定: (:) [Set-ExecutionPolicy]、UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.Set
ExecutionPolicyCommand
PS C:\ProgramFiles2\VMware\Infrastructure\vSphere PowerCLI>
-------------------------------------------------------------
アイコンを右クリックし、「管理者として実行」から起動するとスクリプトの実行を有効化できる。
■再びPowerCLI起動しESXiサーバに接続
-------------------------------------------------------------
Welcome to the VMware vSphere PowerCLI!
Log in to a vCenter Server or ESX host: Connect-VIServer
To find out what commands are available, type: Get-VICommand
To show searchable help for all PowerCLI commands: Get-PowerCLIHelp
Once you've connected, display all virtual machines: Get-VM
If you need more help, visit the PowerCLI community: Get-PowerCLICommunity
Copyright (C) 1998-2011 VMware, Inc. All rights reserved.
PowerCLI C:\ProgramFiles2\VMware\Infrastructure\vSphere PowerCLI> cd /
PowerCLI C:\> Connect-VIServer -User root -Password kamehame8 192.168.xxx.xxx
警告: There were one or more problems with the server certificate:
* The X509 chain could not be built up to the root certificate.
* The certificate's CN name does not match the passed value.
Name Port User
---- ---- ----
192.168.xxx.xxx 443 root
PowerCLI C:\> get-vm
Name PowerState Num CPUs Memory (MB)
---- ---------- -------- -----------
rails02 PoweredOn 1 768
files01 PoweredOn 1 1024
windows7 PoweredOn 1 1024
backup01 PoweredOff 1 512
web01 PoweredOn 1 1024
rails01 PoweredOn 1 768
PowerCLI C:\>
-------------------------------------------------------------



0 件のコメント:
コメントを投稿