Using PowerShell ISE

Kevin Brown
A free video tutorial from Kevin Brown
Windows, Azure, AWS, Cisco, Security Instructor & Author
4.5 instructor rating • 12 courses • 65,608 students

Learn more from the full course

Windows Server 2016 Administration

Windows Server 2016: Nano Server, Server Core, Active Directory, DNS, DHCP, Hyper-V, WDS, WSUS, NLB and more.

10:24:30 of on-demand video • Updated December 2020

  • Install Windows Server 2016 as a Desktop Experience Server, Server Core and as a Nano Server
  • Manage users and computers using Active DIrectory
  • Configure computers using Group Policy
  • Manage DNS
  • Understand Powershell
  • Create and manage Virtual Machines using Hyper-V
  • Implement a DHCP infrastructure
  • Deploy operating systems using Windows Deployment Services (WDS)
  • Backup and Restore Windows Server 2016
  • Implement Data Deduplication to reduce storage
  • Monitor Windows Server performance using built-in tools
  • Install and manage Windows Software Update Service (WSUS)
English [Auto] In this section we want to take a look at the partial integrated scripting engine or IESE. So I'm going to go to tools and server manager and I'm going to open partial IAC a few of the sections in this course have and will cover power shall I see. But to look at that again a few of the configurations this command pane on the right hand side it gives me a list of all the modules installed on my server. I'm going to scroll down the list until I find one named as inby share what if I want a shareholder if I want to look at a shared folder. This SMB share is what I can use for example if I want to view every shared folder on my machine I can type get Dasch SMB share. Now in this list this gives me a list of all the commands that start with get SMB type s so I could just tab through these or click SMB share in the list. And that's what I'll do. Click that. So I get SMB share this list every shared folder on my machine. Presently while on my machine I'm going to go to the root of the C-Drive and there is a shared folder or main sales data at the root of the C-Drive. Now that folder is not shared at the moment. If we go to the properties of that folder on the sharing tab. Notice it says network path not shared sales data not shared. When I also ran the get dash SMB share command you'll see the name of the shares here and you see the path the sales data is not in the path. Now I know the command I could run to actually create a shared folder but let's say you don't know the command but you know what you want to see. And the partial IAC I can go to the SMB share and this gives me every command when I can actually use within SNB Well if I want to create a new share new SMB shares in the list if I select show details I can specify the name of the share the Almelo name it sales and the path I specify the path of the shared folder itself. In my case that is see Colvin's slash sales data. Now there's a space between the words sales and data in the name of that folder. When you share folder it's actually a good idea not to include spaces of an underscore perhaps but I included a space there. So if I want to leave the space I have to wrap this in quotations. If not it's going to read up to the C sales and it's going to think that's where the name actually ends. Well I'm going to click insert when I click insert it bails out the exact power shell command that for me. So I can just hit enter and it's going to share the sales data folder on my C drive and the share name of the folder will be sales. So if someone were to browse the network they're going to see a folder named sales while I'm going to hit enter for that and it tells me that that is now shared. If I run this get Nash SMB share command again I'm going to do that by hitting the up arrow twice and it just recycles through the history of my previous commands when I run get dash SMB share. Notice sales is now in the list if I navigate back to the sales folder itself or sales data actually is the name of the folder if I go to the sharing tab notice it now says sales data is a shared folder. If I click on advance share you'll see the name I specified for the share. It's actually not uncommon in production networks for a folder to have a very detailed name. But the share name that users see may be a more basic or simplistic thing. Well an example of that will be my folder named sales data. I may want that presented to my users as just sales solves cancel those windows there. We just wanted to view that it actually was now a shared folder. If I wanted to build a script that would do this I could come here and play copy on the right hand side and the commands pain and it would take this syntax and it would copy it to the clipboard. I can then take that and paste it in Notepad. Now I would have a script save that notepad file with a dot p.s. one extension and I'll have a power shell script that I could run at any time. When I look at the list of commandments just for SMB that's a pretty long list of commandments in that box there. And I also have a list of modules. Another example since we're already in this tool there there's a VPN client here in the list. We've not yet covered VPN but a VPN is our client that gives me the ability to go home and I have this client on my computer that lets me connect back to my corporate network. So if I need access a file server an application inside my network I can go home and have access to the same application. The concern is security. I want to make sure that no one can hack that connection. I want to make sure all the traffic is encrypted. Well if I want to do that I just install a VPN client on my machine. How many of these exist. Cisco Juniper dozens of manufacturers or vendors for VPN clients are out there including Microsoft. Well if I want to create a VPN client but I don't know the power shell syntax for it I can just go to the module VPN client and I know what I want to do. I want to add a VPN client so choose I have VPN connection show details and this box or just ask me Well what do you want to name the connection. Since we're doing this through power shell I'm just gonna put P.S. Dasch VPN client just so we know it's the one we created to power Chell in case I have others installed on the machine. It also asks What's the IP address that my client should connect to. So what machine back on my corporate network accepts all these connections from my users when they are working from home. I'm going to just make up an address 28 out 1.1 not sixty seven. I could also specify authentication protocols. We'll just pick something in the list. That's not really our concern. The authentication protocols were more interested in how this works to power show. I could also choose my encryption level that will just say we require encryption for this so it Cicare I can even specify these other protocols for tunneling. But again that's not a concern for us. That's something we see in the remote access section. I'm going to just use automatic here. What we are concerned with when I click insert it builds out the entire power line. So if I needed to script this to power shell but I had no idea what the syntax is. Instead of spending hours on Google trying to cobble some command line together and then testing it I can simply come here. So as long as you're familiar with you know how a tool actually works and you just want to know the syntax of it come here fill in all the fields. It builds out that line. Well when I hit enter in power so as long as I have no read I know my command executed properly. Now I'm going to go to my network connections and I'm going to click on change adapter settings and that. Dash VPN client is in the list. I could also undo any of these if I'm looking at my SMB share commands again. One of my commands and SMB is remove SNB share. Now I could click on and remove SNB share here in my Command's pain and I could fill in these fields. I could also just specify the syntax of this. Now you can almost guess at this and typically be correct. The command to create the SNB share was new. Das SNB share Dasch name sales Dasch path that is very basic If I want to remove the share we're just going to freehand the command. So remove bash SMB share. I'll click tab to finish that off. The share I want to move is named sales so I'm going to type remove that SMB share Dasch name sales it'll ask me here and the confirm. Are you sure you want to perform this action performing this operation. Remove share on target sales. While yes I'm sure I'm going to say yes to all. Now if I run that get bash SMB share command again. Notice sales is no longer in the list. So that's unshared. The VPN client we looked at has the same type of configuration. If I go to a VPN client and look at all the commands there is a remove VPN connection. I can specify that I can type the name of that connection which was POS dash. VPN client can spell it correctly. P.S. that VPN client I'm going to click insert and it bills that name. So back in my network connections I'm going to just double check the name of that yeah so I have this stash VPN client when I run my power shell. Enter for that. Believing this VPN connection as client do you want to continue. Well yeah I want to continue I'm like yes. And now when I go back to network and sharing that client is actually gone. So power shell is very simplistic. What I suggest if you want to be more fluent in power shell an easy way to do that is come to this tool and play around. I created a VPN client we created a shared folder just on your personal machine. This partial IAC is actually on Windows 10 so you could go to this on your client machine and go through the list of modules you have to some command lets build some things out. Look at the syntax. Make sure it executes then just freehand some of these power shell commands to help you get up to speed. There are a few other things in this ISC. One is this script's pain at the top. If you click this scripts this arrow and expands the scripts pane. If you have a power shell script that maybe someone else wrote and you need to go through the script line by line and look for errors because the script does not execute properly. You can actually go to file open and you could browse for script and it'll give you the entire syntax of the script here in an easy view and it actually runs what amounts to a spell check against your script. So if you have any invalid commands in your script it will actually underline it to let you know. That's not a valid name so that makes troubleshooting very easy and the next section we're going to look at power shell remoting. So I can see how to connect my power shell prompt to a remote computer.