Wednesday, May 13, 2015

Managing Windows Server 2012 R2 Using PowerShell : Part-2 : Exploring PowerShell Default Settings.

Part 1 : Windows Server 2012 R2 Installation

Part -2

In the Part-1 of this series, we have done a fresh installation of "Windows Server 2012 R2".  That covers our "Installation" section of this tutorial series.
Next section of the series is getting various Information of the server by using PowerShell. In this Section we are going to get some basic and default information of the server.


Let's try to dig some basic information of our newly server using PowerShell. but before exploring anything else let's explore the PowerShell first.
(This server is not joined to domain yet. So everything is set to default as-it-is come.)

1. Information regarding PowerShell

You will see the PowerShell shortcut in the taskbar ( that's cool ). Click on icon to Open PowerShell Console.
5-13-2015 12-12-41 PM
When you open PowerShell console, you will notice, that the PowerShell console is opens in the "Administrator" mode by default. (nice!)
5-13-2015 12-17-14 PM
First thing to check is the default version of PowerShell which come along with "Windows Server 2012 R2", to check the version of  PowerShell , we type and enter the variable name $PSVersionTable , this variable contains the information of PowerShell version.
5-13-2015 12-15-43 PM
In the above output we can see that the value of "PSVersion" (PowerShell Version) is 4.0. That means "Server 2012 R2" shipped with PowerShell version 4.0 installed.
I also want to check, ( Just out of my curiosity), how many cmdlets are there in PowerShell by default in "Server 2012 R2". Total cmdlets are easy to calculate by using Get-Command and brackets and dot notation.

5-13-2015 12-26-08 PM

1311, Wow!, PowerShell on "Windows Server 2012 R2" contains 1,311 ( One thousand, Three Hundred and Eleven cmdlets) by default.
Now, I need to check what is Execution policy is set to ( I am assuming  it might be set to Restricted, but worth checking still.). To check we Execution policy we use the  Get-ExecutionPolicy ".
5-13-2015 12-33-05 PM
Oh! I my assumptions was wrong, the Execution Policy is set to "RemoteSigned" by default. Nice! ( told you, that's it always worth checking.)
Let's check about how many PowerShell modules are installed by default.  Checking the total count is simple, Brackets and dot notation is our best friends.
(Get-Module -ListAvailable * ).count
5-13-2015 12-50-34 PM

63 Modules, PowerShell modules are there. Cool.!
Now, the last thing to check , if PowerShell-ISE is available by default or not.  When I searched for "PowerShell ISE" in search charm, I have found it Smile .

5-13-2015 1-21-38 PM
So, we can conclude everything in the below table.
PowerShell Default Information on Windows Server 2012 R2
Default Version
Number Total PowerShell Cmdlets
PowerShell Execution Policy
Number of Default Modules
PowerShell ISE available by default
Below is the name and version of all of Modules those are available on my "Server 2012 R2" installation by default.
Name and Version Number of all PowerShell Modules
S.NO Name Version ModuleType
1 AppLocker Manifest
2 Appx Manifest
3 BestPractices 1.0 Manifest
4 BitsTransfer Manifest
5 BranchCache Manifest
6 CimCmdlets Manifest
7 DirectAccessClientComponents Manifest
8 Dism 3.0 Script
9 DnsClient Manifest
10 International Manifest
11 iSCSI Manifest
12 IscsiTarget Manifest
13 ISE Script
14 Kds Manifest
15 Microsoft.PowerShell.Diagnostics Manifest
16 Microsoft.PowerShell.Host Manifest
17 Microsoft.PowerShell.Management Manifest
18 Microsoft.PowerShell.Security Manifest
19 Microsoft.PowerShell.Utility Manifest
20 Microsoft.WSMan.Management Manifest
21 MMAgent 1.0 Manifest
22 MsDtc Manifest
23 NetAdapter Manifest
24 NetConnection Manifest
25 NetEventPacketCapture Manifest
26 NetLbfo Manifest
27 NetNat Manifest
28 NetQos Manifest
29 NetSecurity Manifest
30 NetSwitchTeam Manifest
31 NetTCPIP Manifest
32 NetworkConnectivityStatus Manifest
33 NetworkTransition Manifest
34 NFS 1.0 Manifest
35 PcsvDevice Manifest
36 PKI Manifest
37 PrintManagement 1.1 Manifest
38 PSDesiredStateConfiguration 1.0 Manifest
39 PSDiagnostics Script
40 PSScheduledJob Binary
41 PSWorkflow Manifest
42 PSWorkflowUtility Manifest
43 RemoteDesktop Manifest
44 ScheduledTasks Manifest
45 SecureBoot Manifest
46 ServerCore Script
47 ServerManager Script
48 ServerManagerTasks Cim
49 SmbShare Manifest
50 SmbWitness Manifest
51 SoftwareInventoryLogging Manifest
52 StartScreen Manifest
53 Storage Manifest
54 TLS Manifest
55 TroubleshootingPack Manifest
56 TrustedPlatformModule Manifest
57 UserAccessLogging Manifest
58 VpnClient Manifest
59 Wdac Manifest
60 Whea Manifest
61 WindowsDeveloperLicense Manifest
62 WindowsErrorReporting 1.0 Script
63 WindowsSearch Manifest
That's all for now, In the next blog post, we will explore more information with the help of PowerShell.
chaar Sahibzaade
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

No comments:

Post a Comment