Archive for examples

[justfewtuts] Basics of Powershell ~ empowering Windows Config/Admin Automation

Posted in Blogroll with tags , , , , , , , , , , , on December 28, 2011 by abhishekkr

justfewtuts.blogspot.com [24-December-2011]

http://justfewtuts.blogspot.com/2011/12/basics-of-powershell-empowering-windows.html

Basics  of  MS Windows Powershell

Introduction
A dotNet framework based scripting language to automate the configuration/administration of Microsoft Windows machine.
Powershell is loaded with several cmdlets (special command-lets) acting as a built-in shell utilities to perform different tasks on Windows machine for performing administrative tasks.

Getting Started
Powershell’s cmdlets act upon and return objects as a result of any action taken.
These can be used in combination with traditional Windows services like Registry, Net and more.

To try your hands over powershell, access it at ‘Start Menu’ > ‘Accessories’ > ‘Windows Powershell’;
there you’ll get mainly a shell from ‘Powershell’, and an interactive IDE-like shell‘Powershell ISE’.

Using powershell, cmdlets are the main power-source of this Powershell which are discussed briefly below…..

to get a quick /Hello World/ feel of Powershell, you could try on few next steps
* emulating a …..

 [+] to have a Powershell script, check for a system service….. start it if stopped

  $svc_name = “aspnet_state
  $svc_status = Get-Service | Where {$_.name -eq $svc_name} | %{ $_.status }
if (-not $svc_status) {
     Write-Host “Error: $svc_name not found”
}
  elseif ($svc_status -eq “running”){
     Write-Host “status ok $svc_name”
  } else {
     Start-Service $svc_name
}

  [+] Now …..

…..click here to read in detail

Advertisements