Wednesday 26 November 2014

Active Directory RMS management pack

Active Directory RMS management pack


  • Microsoft has released an RMS management pack for Active Directory.This will also cover RMS servers on Windows 2012
  • You can find the download it from here
  • http://www.microsoft.com/en-us/download/details.aspx?id=26911
  • This Rights Management Service Management pack to properly work need local Administrator right on the servers you want to monitor.
  • To install the MP download the MP and install the MSI.It will give you 3MP .Import it

Tuesday 11 November 2014

Get-GPO:How to Get list of Group POlicy in your EnviRornment using Powershell

Get-GPO:How to Get list of Group Policy in your Environment using Powershell



GET-GPO is a very powerfull Command.It gets list of all GPO in your Domain.

To get a list of all GPO, thep

GET-GPO

You will get the below error

PS C:\Users\foxsha> GET-GPO
The term 'GET-GPO' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
lling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:8
+ GET-GPO <<<<
    + CategoryInfo          : ObjectNotFound: (GET-GPO:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


The reason for this error is that there is no Module Available for Active Directory

So first Import the Module using Command

Import-Module "grouppolicy"

You will see the below error

PS C:\Users\foxsha> Import-Module "grouppolicy"

Import-Module : The specified module 'grouppolicy' was not loaded because no valid module file was found in any module
directory.
At line:1 char:14
+ Import-Module <<<<  "grouppolicy"
    + CategoryInfo          : ResourceUnavailable: (grouppolicy:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

The resaon for this error is that there is no Group policy Feature installed so first we need to install the group policy features

If you are on your desktop and not on Server,you need to go to below location and download and install it


Then go to Programs and Features in Control Panned .Click "Turn Windows Feature On or OFF " and select "Group policy management"

Now try " Import-Module "grouppolicy" and then GET-GPO and it will run sucesfully

Monday 10 November 2014

Get-Process:How to capture the list of process running on the Computer using Powershell

How to capture the list of process running on the Computer using Powershell


  • To list all process running on the computer use the Command
           Get-Process

          This will give you list of all the process running on your system.
  • To count number of process running on the system,use
          (get-process).count





  • To output the Process to textfile so that you can send email to your support team with details,use
         get-process | out-File -FilePath c:\temp\testpr.txt


         This will give you output to text file.

  • If you want only to check if particular process is running, then use
          get-process | select-string "goog"


Sunday 9 November 2014

Get-Content:How to use Get-content to Count the Number of Lines in the File

How to use Get-content to Count the Number of Lines in the File

Get-Content is a very powerful command and you will use it very often in your script.


  • Lets say You want to see all Counte of file,type


Get-Content C:\temp\t1.txt

Where C:Temp is the folder path where the file is and t1.txt is the filename


  • Now if you want to Count the number of Files in the file then, use


(get-content c:\temp\t1.txt).count

This will give the number of Lines in the File


  • Now say you want to Pjust first 5 lines in the File, then use


(get-content c:\temp\t1.txt -totalcount 5)

This will give you the first 5 lines


Also to see only Line where Particular word is matching use the below command

get-content C:\temp\t1.txt | select-string "get-c"

This will show lines only where "get-c" matches

Saturday 8 November 2014

Get-Alias and useful Examples

Get-Alias and useful Examples


  • Get-Alias is very useful Powershell Command.It gives alternate name for the Commands.Instead of long form you can use the short Alias form. Lets see some example.
  • In order to find the Alias of "Get-Service" command which list all the services running in the computer and there running state, type the following Command in Powershell Windows

                      GET-Alias -definition Get-Service.




  • You can see that the Alias for Get-Service command is gsv.
  • So nextime to check this list of service and their status type just "gsv"

How to Check if Powershell is installed on your Computer?

How to Check if Powershell is installed on your Computer?


  • To check if Powershell is installed on your Computer
  • Go to C: Drive and  Click on "Windows" Folder
  • Now click on Sytem32 folder then Click on "WindowsPowerShell" Folder
  • Now depending on the Version of Powershell installed You will se it as v1.0 or v2.0 or v3.0. This tell you what version of Powershell is installed.
  • Now in our case is v1.0. Click on v1.0 folder.
  • You will see a "Powershell.exe". This confirms that Powershell is installed on your system.