Sunday, 6 July 2014

Starting PowerShell from the Basic Commands !

I am giving some very basic powershell cmdlet for the beginners.


Get-Help
You will be able to understand how to perform each and every command available in PS using help command. Before using powershell help you have to update the help with latest update. Update help is the new features available in PowerShell 3.0. Not available in previous version of PS. Update-help is the command used to update the help content. I am giving some example for updating help.

# PowerShell 3.0 Updateable Help.
Below is the command to update help directly from Internet..

001
Update-help -force

Do you need any help on getting all the powershell commands ???
If YES just go ahead and open powershell and type Get-Help. This is the first cmdlet every administrator should learn.

# Remember to run powershell as "Run as Administrator" (As the files will be stored under root file which is restricted by default)
# Get-help Update-help Will provide more details about how to update help

Force is using to update the help file forcefully.












We can save the help file using save-help cmdlet. This will allows you to download the newest help files for windows powershell and save in a specified directory.This feature lets you to update the help file on computer that do not have Internet availability.
Below is the cmdlet used to save the help-files and update from saved place.. We have to specify the UI Culture  while downloading the help files. (Get-UICulture is the command to get the UICulture of the system)

001
002
Save-Help -UICulture en-US -DestinationPath C:\Users\vivek\PSHelp -Verbose
Update-Help -SourcePath C:\Users\vivek\PSHelp -Verbose

Get-Command

Can you remember all the cmdlets in powershell ???

If NO, get-command will help you to retrieve all the available powershell commands.If you remember any words in the command, you can easily retrieve the command. But it will not display the additional parameters and display all the command in console by default.

# Out-GridView : This cmdlet will display the output in  different windows and will help you to read it properly

001
002
003
Get-Command Get-Help
Get-command get-exe*

Get-member

Get-Member is an essential command for discovering more about a PowerShell objects.As you can see, powershell output shows us some of the default properties, not all. We can use get-member cmdlet to retrieve all the properties of an object. More over we will be getting all the methods of an object by using get-member.

001
Get-Process | Get-Member

GM is the alias for Get-Member

1 comment: