Connect to VMWare From PowerShell

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to Tom's tech show today we are connecting PowerShell and VM our welcome Tom's tech show I'm Tom of course and today we're gonna install VMware PowerShell CLI onto our lab box that I have set up because we want to be able to connect and do things from PowerShell and manipulate our VMware environment so the easy way is to download the VMware PowerShell program run through the installation really quick it doesn't take too long installs a few things I'll probably fast forward so we'll get the main page up and then we'll jump to the end ok here we go we go next pretty easy except license agreement I just installed everything makes it just easier so now the installation starts running so let's jump to the end ok we're at the end now there's one last thing we have to do and that is reboot so we'll be right back after I reboot ok now that we rebooted if you do get an error when you first install it reboot that you will usually take care of it now we want to see what we can do with our commands so we open up the power CLI gets us to here we can type in like this first commands that we need to do is connect to a server so connect the ice / - whatever happens to me 192 168 that 1.3 then it's going to ask me to log in here in a second and we're gonna web user if I could type okay so it's gonna come back boom PowerShell is now connected I can do some things like and get VM and this is going to show me all of the resources that I have access to with this user this user is an administration user so it's gonna give me everything on the box so this really isn't where I want to be putting the commands though for me I want to be able to write code and add this to my code so that I can connect to virtual center or a VMware host without having to run the via you know PowerShell VMware power CLI command so what we do is we go put in our top of our script we put ampersand and then the location of this initialize power CLI environment and we can find that directory by getting looking at the properties of this shortcut so there's the power seal initialize power see live if we look back and we can see it's Program Files x86 VMware infrastructure power CLI scripts then the initialize our CI environment so that's going to give me that command and I've also added here connect to server and we're going to update our so over here to be our 1.3 that's our web user and that's our password and yes the password here is in the clear there ways to do it so it's not but for my example here we're gonna put it in the clear so I run this script and you can see on the screen now we're loading that parish it's a light module and now it's going to connect to the server and boom now I'm on the server and I can still do get VM and it's going to get me a list of VMs but now it's in one of my PowerShell scripts it's not in the VM more power CLI command line that you have to launch so from there I can start doing things like creating snapshots creating backups creating VMs turning VMs on and off doing all that programmatically instead of doing it through the web console or through the other command line okay so that's how we connect it and I hope this has been helpful thanks for watching this is Tom from Tom's tech show and God bless [Music]
Info
Channel: Tom's Tech Show!
Views: 1,115
Rating: undefined out of 5
Keywords: VMWare, PowerShell, Scripting
Id: dsK6uU2hxPQ
Channel Id: undefined
Length: 4min 45sec (285 seconds)
Published: Thu Dec 27 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.