Posted in Uncategorized

PowerShell Commands for my reference

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of acommand-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to COMand WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and CIM enabling management of remote Linux systems and network devices.

 

How to enable the Active Directory Modules and Commandlets

For Windows 2008 R2 Server

Open an elevated Powershell console window and run the following commands:

PS C:\> import-module servermanager

PS C:\> Add-WindowsFeature -Name “RSAT-AD-PowerShell” -IncludeAllSubFeature

PS C:\>import-module activedirectory

PS C:\>Get-ADDomain

Now you can refer the CMDLETs from the link and execute the commands

How to search for a text content in large number of files using PowerShell

I was making a WI modification and was looking for a text word in the config files. Windows search does not result well where the below command helped me well.

PS C:\>Get-ChildItem -Recurse | Select-String “Text word to be searched”

 

 

 

 

 

 

 

 

Advertisements