PowerShell ISE
The Windows PowerShell Integrated Scripting Environment (ISE) is a host application for Windows PowerShell. In Windows PowerShell ISE, you can run commands and write, test, and debug scripts in a single Windows-based graphic user interface with multiline editing, tab completion, syntax coloring, selective execution, context-sensitive help, and support for right-to-left languages.
You can use menu items and keyboard shortcuts to perform many of the same tasks that you would perform in the Windows PowerShell console. For example, when you debug a script in the Windows PowerShell ISE, to set a line breakpoint in a script, right-click the line of code, and then click Toggle Breakpoint.
To open it you just go to Start – Search and then Type – PowerShell as shown in the following screenshot.
Then click on Windows PowerShell ISE. Or click on the downward Arrow as shown in the following screenshot.
It will list all the applications installed on the server and then click on Windows PowerShell ISE.
The following table will be open −
It has three sections, which include – The PowerShell Console with number 1, then Scripting File number 2 and the third is the Command Module where you can find the module.
While creating the script you can run directly and see the result like the following example −
PowerShell Basic Commands
There are a lot of PowerShell commands and it is very difficult to put in all these commands in this tutorial, we will focus on some of the most important as well as basic commands of PowerShell.
The first step is to go to the Get-Help command which gives you an explanation about how to give a command and its parameter.
To get the list of Updates −
- Get-HotFix and to install a hot fix as follows
- Get-HotFix -id kb2741530
Remote Management
Remote Management Service is one of the most important part pertaining to administration of Windows Server 2012. Administration of servers is performed through Windows Management Instrumentation. WMI instructions can be sent over network WinRM “Remote Management”.
By default this utility is enabled, you can check it by going to Server Manager → then click on Local Server as shown in the following screenshot.
If in case it is disabled, you can enable it by Opening PowerShell and then typing EnablePSRemoting as shown in the screenshot given below.
There is another way to enable it – Click on “Server Manager” → Local Server, then ENABLE Remote management.
Adding a Server for Remote Management
To add other servers for remote management, follow the steps given below −
Step 1 − Server Manager → Dashboard → Add other servers to manage.
Step 2 − If the servers are joined to the domain, you add the select option “Active Directory“, in my case they are not joined, so I selected the second option “DNS” → In the search Box, I added the IP of the server that has to be managed → click on a small arrow → OK.
Step 3 − Go to Server Manager → All Servers, you will see the server that you have added. As my server is in the Work Group, I have to right click and click on – “Manage As” as shown in the following screenshot.
Step 4 − Enter the credentials of the remote server as follows and then → OK.
To remove a managed server, Right Click on server → Remove Server.
Windows Server 2012 - Windows Firewall
The Windows Firewall with Advanced Security is a firewall that runs on the Windows Server 2012 and is turned on by default. The Firewall settings within Windows Server 2012 are managed from within the Windows Firewall Microsoft Management Console. To set Firewall settings perform the following steps −
Step 1 − Click on the Server Manager from the task bar → Click the Tools menu and select Windows Firewall with Advanced Security.
Step 2 − To see the current configuration settings by selecting Windows Firewall Properties from the MMC. This allows access to modify the settings for each of the three firewall profiles, which are – Domain, Private and Public and IPsec settings.
Step 3 − Applying custom rules, which will include the following two steps −
- Select either Inbound Rules or Outbound Rules under Windows Firewall with Advanced Security on the left side of the management console. (As you Know outbound traffic is the traffic generated from server towards the internet and inbound traffic is vice versa). The rules that are currently enabled are denoted by green checkbox icon, while disabled rules display a grey checkbox icon.
- Right-clicking a rule will allow you toggle enable/disable.
How to Create a New Firewall Rule?
To create a new Firewall Rule, you have to adhere to the following steps −
Step 1 − From the right side of either the Inbound Rules or Outbound Rules – click “New Rule”.
Step 2 − Custom from the Rule Type radial button → click Next.
Step 3 − Select the Program association for the Custom Firewall Rule as either All programs or the path to a program → click Next.
Step 4 − Protocol type field select the protocol type → click Next.
Step 5 − Select an IP address association for both local and remote addresses → click Next.
Step 6 − Select an action to take on matching traffic → click Next.
Step 7 − Select the profiles associated with the custom rule → click Next.
Step 8 − Put a name for your Firewall rule and an optional description → Finish.
Step 9 − The firewall rule can be found on the corresponding Rule tab, either inbound or outbound depending on the type created. To disable or delete the rule find the rule in the MMC, right-click it and select either Disable Rule or Delete.
Remote Desktop Management
In this chapter, we will see how to enable remote desktop application. It is important because this enables us to work remotely on the server. To do this, we have the following two options. For the first option, we have to follow the steps given below.
Step 1 − Go to Start → right click “This PC” → Properties.
Step 2 − On Left side click “Remote Setting”.
Step 3 − Check radio button “Allow Remote connection to this computer” and Check box “Allow connection only from computers running Remote Desktop with Network Level Authentication (recommended)” → click “Select Users”.
Step 4 − Click Add.
Step 5 − Type user that you want to allow access. In my case, it is administrator → click OK.
For the second option, we need to follow the steps given below.
Step 1 − Click on “Server Manage” → Local Server → click on “Enable” or Disable, if it is Disabled.