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.
InformationTab 

INFORMATION

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.
(Get-Command).count

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
4.0
Number Total PowerShell Cmdlets
1,311
PowerShell Execution Policy
RemoteSigned
Number of Default Modules
63
PowerShell ISE available by default
Yes
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 2.0.0.0 Manifest
2 Appx 2.0.0.0 Manifest
3 BestPractices 1.0 Manifest
4 BitsTransfer 1.0.0.0 Manifest
5 BranchCache 1.0.0.0 Manifest
6 CimCmdlets 1.0.0.0 Manifest
7 DirectAccessClientComponents 1.0.0.0 Manifest
8 Dism 3.0 Script
9 DnsClient 1.0.0.0 Manifest
10 International 2.0.0.0 Manifest
11 iSCSI 1.0.0.0 Manifest
12 IscsiTarget 2.0.0.0 Manifest
13 ISE 1.0.0.0 Script
14 Kds 1.0.0.0 Manifest
15 Microsoft.PowerShell.Diagnostics 3.0.0.0 Manifest
16 Microsoft.PowerShell.Host 3.0.0.0 Manifest
17 Microsoft.PowerShell.Management 3.1.0.0 Manifest
18 Microsoft.PowerShell.Security 3.0.0.0 Manifest
19 Microsoft.PowerShell.Utility 3.1.0.0 Manifest
20 Microsoft.WSMan.Management 3.0.0.0 Manifest
21 MMAgent 1.0 Manifest
22 MsDtc 1.0.0.0 Manifest
23 NetAdapter 2.0.0.0 Manifest
24 NetConnection 1.0.0.0 Manifest
25 NetEventPacketCapture 1.0.0.0 Manifest
26 NetLbfo 2.0.0.0 Manifest
27 NetNat 1.0.0.0 Manifest
28 NetQos 2.0.0.0 Manifest
29 NetSecurity 2.0.0.0 Manifest
30 NetSwitchTeam 1.0.0.0 Manifest
31 NetTCPIP 1.0.0.0 Manifest
32 NetworkConnectivityStatus 1.0.0.0 Manifest
33 NetworkTransition 1.0.0.0 Manifest
34 NFS 1.0 Manifest
35 PcsvDevice 1.0.0.0 Manifest
36 PKI 1.0.0.0 Manifest
37 PrintManagement 1.1 Manifest
38 PSDesiredStateConfiguration 1.0 Manifest
39 PSDiagnostics 1.0.0.0 Script
40 PSScheduledJob 1.1.0.0 Binary
41 PSWorkflow 2.0.0.0 Manifest
42 PSWorkflowUtility 1.0.0.0 Manifest
43 RemoteDesktop 2.0.0.0 Manifest
44 ScheduledTasks 1.0.0.0 Manifest
45 SecureBoot 2.0.0.0 Manifest
46 ServerCore 1.0.0.0 Script
47 ServerManager 2.0.0.0 Script
48 ServerManagerTasks 1.0.0.0 Cim
49 SmbShare 2.0.0.0 Manifest
50 SmbWitness 2.0.0.0 Manifest
51 SoftwareInventoryLogging 2.0.0.0 Manifest
52 StartScreen 1.0.0.0 Manifest
53 Storage 2.0.0.0 Manifest
54 TLS 2.0.0.0 Manifest
55 TroubleshootingPack 1.0.0.0 Manifest
56 TrustedPlatformModule 2.0.0.0 Manifest
57 UserAccessLogging 1.0.0.0 Manifest
58 VpnClient 2.0.0.0 Manifest
59 Wdac 1.0.0.0 Manifest
60 Whea 2.0.0.0 Manifest
61 WindowsDeveloperLicense 1.0.0.0 Manifest
62 WindowsErrorReporting 1.0 Script
63 WindowsSearch 1.0.0.0 Manifest
That's all for now, In the next blog post, we will explore more information with the help of PowerShell.
chaar Sahibzaade
Regards.
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

Note: Only a member of this blog may post a comment.