Hi,
As this is the first blog, I start with one of my favorite tools, yes windows PowerShell. Go on further to explore more..
Powershell is a new scripting revolution which windows has brought and every admin, developer,support and tester would love to work with it. Long note in short powershell gives the commandline scripting power to manage and automate day to day tasks which GUI based application does and that too from command line. To add to it , it gives the full power to use .NET objects, thats the coolest part of it.
Learn more about it and how to install on XP(1.0) / Vista/Win 7(2.0) here http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx
In this blog, I just show a small example which I require almost daily on my 2Gigs machine (supercomp ;) ), to start and stop oracle services. This is because I dont have enough RAM to accomodate VM running on same box.
Powershell comprises of command lets (Cmdlets : GET, SET etc) which can be used to retrieve and set information for windows. So instead of boring mouse clicks to search for services and start stop, I put the cmdlets in script and run as a batch file, simple single mouse click huhh?
Ok put this simple script into file called .ps1 (powershell script extension) and save in a folder.
$srvName = "OracleServiceORCL"
$servicePrior = get-Service $srvName // Use Get-service cmdlet
start-service $srvName
Remember to change variable $srvName which is OracleServiceORCL on my machine. Now put the below code in a .bat file and call this .ps1 file from a powershell command prompt as below :
cd pwshell //my directory name
powershell.exe .\OracleStart.ps1 // Start powershell with scriptname as parameter
Now simply click on this bat file will start the oracle services, and a similarly user can write another script to stop oracle services.
Pretty nice indeed , simply powershell!!!
more blog on debugging will soon come..
cheers
kirann
No comments:
Post a Comment