Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Windows PowerShell  (Read 3037 times)

0 Members and 1 Guest are viewing this topic.

anoopj

  • Guest
Windows PowerShell
« on: November 21, 2013, 07:30:55 pm »
PowerShell is a command-line shell and scripting language designed for windows system administration. Windows PowerShell helps to control and automate the administration of Windows operating systems and of applications that run on Windows. PowerShell built on the Microsoft .NET Framework.

In windows, powershell helps to complete various tasks. The following list is a sampling of these tasks…

Manage processes — To list , stop, and start processes.

Use Windows Management Instrumentation (WMI): To manage not only Windows, but also other platforms such as IIS and Terminal Services.

Manage the file system: To create, delete, modify, and set permissions for files and folders.

Manage a number of Windows roles and features: To add or remove roles and features.

Manage services: To list, stop, start, restart, and even modify services.

Manage the Registry: To list , stop, and start processes.

Use existing Component Object Model (COM) objects: To complete a wide range of automation tasks.

PowerShell command examples

Get-Help : Command to get help with any other command.

Eg: Get-Help -Name Get-Process

Get-Process: To get list of processes that are currently running on the system.

Stop-Process: To terminate a process. You can terminate a process either by its process name or by its process ID.

Eg: Stop-Process -Name notepad
Stop-Process -ID 2668

Set-ExecutionPolicy: Command to control the level of security PowerShell scripts

Restart-Computer: To restart a remote computer or computers

Restart-Service: To restart a service with PowerShell

dir r | select string “test”: To search recursively for a certain string within files

ps | sort p ws | select last 3: Find the three processes using the most memory

invoke-command -computername mac1, mac2 -filepath c:\Script\scriptsample.ps1: Run a script on a remote computer

Get-Eventlog: The Get-Eventlog cmdlet retrieves Windows event logs