生活随笔
收集整理的這篇文章主要介紹了
远程用power shell 管理vmware view 池用户
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?
??1.?在客戶端安裝POWER?SHELL?V2.0的系統(tǒng)補(bǔ)丁,補(bǔ)丁號碼為KB968930,里面包括了winrm和powershell?2.0??2.?將view?connection?server服務(wù)器設(shè)置為winrm的信任主機(jī):??PS?C:\?set-item?wsman:\localhost\Client\TrustedHosts?-value?'IP'為了能在計(jì)算機(jī)上執(zhí)行腳本,需要執(zhí)行PS?C:\?Set-ExecutionPolicy -ExecutionPolicy unrestricted?3.?建立連接,并賦值給變量:??PS?C:\>?$remote=new-pssession?-computername?'IP'?-credential?administrator??4.?查看view?connection?server服務(wù)器的模塊:??PS?C:\>?Invoke-Command?$remote?{get-pssnapin}??5.?將Vmware?view模塊加入到power?shell:??PS?C:\>?Invoke-Command?$remote?{add-pssnapin?vmware.view.broker}??6.?將用戶加入到池的授權(quán)列表中:??PS?C:\>?Invoke-Command?$remote?{get-user?-name?'username'?|?add-poolEntitlement?-pool_id?'poolid'??7.?將用戶從池的授權(quán)列表中刪除:??PS?C:\>?Invoke-Command?$remote?{get-user?-name?'username'?|?remove-poolEntitlement?-pool_id?'poolid'?8.?刪除和遠(yuǎn)程服務(wù)器的連接管道??PS?C:\>?remove-pssession?$remote?
-------------------------------------------------------------------------------
?
將密碼保存進(jìn)文件,用時(shí)再取出的方法:??1。?將輸入的密碼保存進(jìn)文件:??PS?C:\>?read-host?-assecurestring?|?convertfrom-securestring?|?out-file?C:\pass.txt??2。?取出密碼:??PS?C:\>?$password?=?get-content?C:\pass.txt?|?convertto-securestring??3。?構(gòu)建credential對象:??PS?C:\>?$credentials?=?new-object?-typename?System.Management.Automation.PSCredential?-argumentlist?"myusername",$password? ?
轉(zhuǎn)載于:https://blog.51cto.com/flybozhou/631159
總結(jié)
以上是生活随笔為你收集整理的远程用power shell 管理vmware view 池用户的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。