Always A-HEAD, By being ahead you are always master of time

Hits

BOOKS

Saturday, December 30, 2006

Review Year 2006

Review Year 2006

Year 2006, has been far far different than I can put in words. I certainly have experienced it in much different manner than I can imagine. January 2006 I have been to London Via Texaco. It was certainly great opportunity, to understand culture of UK. I liked the fact, people respect each other so much. I have certainly gone down and shared that experience with my friend. Lot of them really liked it. More I say of UK it will be less. But difficult circumstances lead me to leave Texaco, and I joined Sussee,Singapore. Culture of Singapore is so much different than UK. Two totally different countries. These experience goes far beyond in understanding not only culture but also working style,Architechure of city, Construction, Innovation and above all collating all this information, to do similar things in India at whatever level you can.I'm thankful to GOD and all other people who have helped me out time and when I needed them, to reach such places.

On career front, I've learnt VB Script, the fact that I felt need within myself to learn, has paid me a lot. Understanding of VB Script has not only increased my domain knowledge but also gave me edge over all other Admins. It was like one day I went to Shop and got the Book for 350 Rs (I'm surprised because I thought it was costly), Started learning from the Book daily. And what ...I made a daily schedule and started moving towards achieving the goal of finishing it in 3 months Flat. I did it. And during this journey I experienced how powerful,confident you feel when you are about to reach towards your goal. Joyful and pleasant to catch in lucid words. Multiple goal has potential to give this Kind of Happiness.

All those planning,daily schedules got inspired by Robin Sharma's book Monk who .....Great Book. As we all know if you understanding (learn)something and you don't implement it, then you have not understood. Based on this experience I've decided to come up on number of books I should be reading in year 2007. I feel proud to apply the same VB Script knowledge to make Admin life easier in previous and current Organizations. When power shell got released, it was like dream came true, Because my knowledge of VB Script has cultivated my Mind, which obviously saw advantage of PowerShell. As result I have come up with Idea of Blog. Techstarts has great ideas I had: To utilize power of shell.

Financially year 2006 more or less can compete with BSE Index growth,India. Next year's goal is to leverage on it.

Purchases: Laptop was major and most beneficial.

Trips: Ooty,Kodai Kanal,Mysore

Books Read: Cracking the Code of Millionaire;Monk who sold his Ferrari;Timeless Wisdom;The Man eater of Malgudi;The One Minute Manager;Adventures_of_Sherlock_Holmes.

Relations:This is the front, I have continued to be at lost, Because every time I change my serving point, I lost all relations which has been built in that organization. This is deeply felt by me.Every time I think of it, Blame game starts in my Mind.



I wanted to keep review as small as possible, since I don't think everyone would love to read this. I'm currently reading 8th Habit of highly effective people, inspired by one of the chapters I decided to share few things with you.Since we all know "Knowledge is a power which continues to grow unless you share it." These events were certainly not planned but had I planned I can't say anymore how much effectively year 2006 would've been utilized.

But I certainly take this as starting point and this is the place I always consider as base point. From where I would continue to accelerate in forward direction. I would suggest you all to start something like this, so your planning for entire year would start for 2007.

For example:

  1. How many books you are going to read this year
  2. How many days you are planning vacation this year
  3. How much you plan to save this year
  4. Where you want to be at the end of the year

Below mentioned article inspired me to review 2006 in my life...how about you?.........

Please feel free to comment. I would certainly look forward at least ONE.

Happy New Year 2007


So, this holiday season, I respectfully suggest that you take the time to review 2006. Find a sacred space, grab your journal and write down your answers to the following questions. First, write the story of the year. Describe how 2006 went for you in as much detail as possible. Open your journal and describe the year that just happened. What were your successes? Your disappointments? What experiences were breathtakingly great? Try to recall each month or season and describe all aspects of your life. Your career, your finances, your relationships, your health, your contribution. Yes, I know that this will take some time. However, leadership is about doing the right things not the easy things.

Second, look at your goal sheets, schedule and journal from the year. How did you do on your goals? Give yourself a mark for each of your goals. If you committed to running a faster 10k and you did then give yourself a ten out of ten. If you aimed to read 50 books and only read 40 then give yourself and 8 out of 10. After reviewing your performance (big idea: all great companies and leaders look at their past performance) look for patterns. Did you excel and business but let your health slide? Did you let disappointments get in the way? Did you make the necessary mid-course corrections when circumstances changed? Reflect on your decisions. How did you perform as a decision maker? Did later events confirm your assumptions? Did you act too quickly or not quickly enough?

- Robin Sharma

Friday, December 29, 2006

PowerShell RSS Reader

$oIE=new-object -com internetexplorer.application
$oIE.navigate2("About:blank")
while ($oIE.busy) {
sleep -milliseconds 50
}
#$oIE.visible=$true

$feed=[xml](new-object system.net.webclient).downloadstring("http://www.rediff.com/rss/newsrss.xml")

#$feed=[xml]$(get-content C:\Preetam\Money.xml)
$results=$feed.rss.channel.item Select-Object TITLE,DESCRIPTION ConvertTo-Html
$oDocBody=$oIE.document.documentelement.lastchild ;
#populate the document.body
$oDocBody.innerhtml=$results
$oDocBody.style.font="10pt Arial";
$oIE.document.bgcolor="#D7D7EA"
#Reading back from IE.
$oTBody=@($oIE.document.getElementsByTagName(">] ;
foreach ($oRow in $oTBody.childNodes)
{$oRow.bgColor="#AAAAAA" ;}
#Prepare a title.
$oTitle=$oIE.document.createElement("P")
$oTitle.style.font="bold 20pt Arial"
$oTitle.innerhtml="PowerShell NEWS Reader";
$oTitle.align="center" ;
#Display the title before the Table object.
$oTable=@($oIE.document.getElementsByTagName(">] ;
$oDocBody.insertBefore($oTitle,$oTable) > $null;

#$line=$oIE.document.createTextNode("MADEND")
#$Para=$oIE.document.createElement("HR")
#$oDocBody.appendchild($Para)
#$oDocBody.appendchild($Para)
#$oDocBody.appendchild($line)

#--------------------------------------------------------------

$feed01=[xml](new-object system.net.webclient).downloadstring("http://www.rediff.com/rss/moneyrss.xml")
$results01=$feed01.rss.channel.item Select-Object TITLE,DESCRIPTION ConvertTo-Html
$oDocBody=$oIE.document.documentelement.lastchild.firstchild ;
#populate the document.body
$oDocBody.innerhtml=$results01
$oDocBody.style.font="10pt Arial";
$oIE.document.bgcolor="#D7D7EA"
#Reading back from IE.
$oTBody=@($oIE.document.getElementsByTagName(">] ;
foreach ($oRow in $oTBody.childNodes)
{
$oRow.bgColor="#336600" ;

}
#Prepare a title.
$oTitle=$oIE.document.createElement("P")
$oTitle.style.font="bold 20pt Arial"
$oTitle.innerhtml="PowerShell NEWS Reader";
$oTitle.align="center" ;
#Display the title before the Table object.
$oTable=@($oIE.document.getElementsByTagName(">] ;
$oDocBody.insertBefore($oTitle,$oTable) > $null;
$oIE.visible=$true



Before I begin, what this script does, let me thank three people over here.

Scott Hansell --------> http://www.hanselman.com/blog : For giving such superb presentation on parsing XML via PowerShell ..worth watching...

Website Brainjar --------> http://www.brainjar.com/dhtml/intro/default2.asp This site tells us how to parse HTML tags; I’ was absolutely dumb about it before I visited it.

PowerShell Blos --------> Yuksel Akinci http://blogs.msdn.com/powershell/archive/2006/09/10/748883.aspx This where I got the hint of parsing and formatting html output.

Disclaimer: This is no way like a RSS reader, as you get on internet, it is just explains latent potential lies in Powershell to unleash power of XML, Non-programmer like me it has been very simple to prove it. Of course code can be made much more complex get our favourite RSS reader formatted in our own way. And there is already something like this on Wiki (http://en.wikipedia.org/wiki/Windows_PowerShell)

Code is nothing if you know DOM (document object modelling).

$feed=[xml](new-object system.net.webclient).downloadstring(http://www.rediff.com/rss/newsrss.xml)

I have pulled two separate XML file from the internet and pasted into HTML document using DOM. To do this I have to typecast which means to convert thing specifically into XML;if this is missing it is normal HTML document.

After that I have converted them into html format

$results=$feed.rss.channel.item Select-Object TITLE,DESCRIPTION ConvertTo-Html

After this everything is about formatting HTML in way it looks as attractive HTML page

$oDocBody=$oIE.document.documentelement.lastchild.firstchild ;

Above line is important since this line actually pulls the second link and drops it in first child of last child, it can get tricky if you more xml links.

Lastly how to run it, you will need to change ("http://www.rediff.com/rss/newsrss.xml") and get your favourite XML link, of course one you have it you don’t need to change everytime. Atleast I’ve made provision for two RSS links, further can be made easily

Technorati tags: , ,

del.icio.us tags: ,


Monday, December 25, 2006

Bulk Ping Via PowerShell

CODE:

$readfile=get-content "E:\PowerShell\MakesSense\Servers.txt"
foreach($readf in $readfile)
{
$ALive=get-wmiobject win32_pingstatus -Filter "Address='$readf'" | Select-Object statuscode

if($ALive.statuscode -eq 0)
{write-host $readf is REACHABLE -background "GREEN" -foreground "BLACk"}
else
{write-host $readf is NOT reachable -background "RED" -foreground "BLACk"}
}

OUTPUT:

I was reviewing my codes and I realise it would only start making difference only when I show the output. Also most of the codes in previous post might not work, because of formatting. But I want to know which are not actually working. Please let me know if you come across something like this.

Remember to create servers.txt file and put in all servers in txt file which you which to ping.

Apart from this, I'm getting question in similiar nature what can you do with powershell. Yes that is very simple to answer and believe it, if you go to the MS Site mentioned below.

Worth Visiting collection of Powershell Scripts, you are bound to love it.

What Can I Do With Windows PowerShell?

Flickr tags: ,

Technorati tags: ,

Friday, December 22, 2006

Windows Vista Capable and Premium Ready PCs

Please check the link below to get official guide in what exactly is VISTA's requirement.

 

A Windows Vista Premium Ready PC includes at least:

  • 1 GHz 32-bit (x86) or 64-bit (x64) processor1.
  • 1 GB of system memory.
  • Support for DirectX 9 graphics with a WDDM driver, 128 MB of graphics memory (minimum)2, Pixel Shader 2.0 and 32 bits per pixel.
  • 40 GB of hard drive capacity with 15 GB free space.
  • DVD-ROM Drive3.
  • Audio output capability.
  • Internet access capability.

Get Feeded here :Windows Vista Capable and Premium Ready PCs

Vista's Feature :Aero Feature   Let me know how many of them are requirment of daily use at the cost of Hardware.

Flickr tags: ,

Technorati tags: ,

PowerShell-MSClustering

PowerShell -MSCluster-WMI
Word multithreading itself is obfuscating for me, and then think what programming can be for me. But powershell renews interest in me to become one, specially when .Net classes are invoked from here.

Simple example is here
$shell=new-object -com shell.application
$shell.ShutdownWindows()


And not that, there are so many other Methods available which can of great use, to find them all here...just type

$shell get-member

There was some problem in watching recording of web cast, so I decided to download only PPT’s, since I was hungry of codes and the latent thinking that generates in me out of the codes. I saw foreground and background impact. Instantly I thought hmmm looks different. And then mind starts to think….as it is mentioned in
8th Habit
No thing is as powerful as the idea whose time has come…..

Lots of jabbering lets get to the code.



Write-Host "CLUSTER VIEW ONLY IN THE ORDER OF DEPENDANCY" -backgroundcolor "GREEN" -FOREGROUNDCOLOR "BLACK"
WRITE-HOST " " -backgroundcolor "YELLOW"
WRITE-HOST "RESOURCE: QUROUM" -backgroundcolor "DARKRED"
Get-WmiObject -namespace root\mscluster -computername CLUSTERNAME -class mscluster_resource where{$_.type -eq "Physical Disk"} Select-Object Name,description,State
WRITE-HOST " " -backgroundcolor "GRAY"
WRITE-HOST "RESOURCE: NON SYSTEM DRIVES" -backgroundcolor "DARKRED"
Get-WmiObject -namespace root\mscluster -computername CLUSTERNAME -class mscluster_resource where{$_.type -eq "Volume Manager Disk Group"}
WRITE-HOST " " -backgroundcolor "GRAY"
WRITE-HOST "RESOURCE: IP ADDRESS" -backgroundcolor "DARKRED"
Get-WmiObject -namespace root\mscluster -computername CLUSTERNAME -class mscluster_resource where{$_.type -eq "IP address"}
WRITE-HOST " " -backgroundcolor "GRAY"
WRITE-HOST "RESOURCE: NETWORK NAME" -backgroundcolor "DARKRED"
Get-WmiObject -namespace root\mscluster -computername CLUSTERNAME -class mscluster_resource where{$_.type -eq "Network Name"}
WRITE-HOST " " -backgroundcolor "GRAY"
WRITE-HOST "RESOURCE: FILE SHARE" -backgroundcolor "DARKRED"
Get-WmiObject -namespace root\mscluster -computername CLUSTERNAME -class mscluster_resource where{$_.type -eq "File Share"}



Code is very simple but results you get out of it are truly superb. Formatting makes life easier and interesting.I thought of using WMI/Clustering to get the results.

Lets get to first line
WRITE-HOST "RESOURCE: QUROUM" -backgroundcolor "DARKRED"
Get-WmiObject -namespace root\mscluster -computername CLUSTERNAME -class mscluster_resource where{$_.type -eq "Physical Disk"} Select-Object Name,description,State

My intention here is to sort cluster resource by type. In other words you puch below line on CMD prompt.

Cluster /cluster:CLUSTERNAME RESOURCE

And you would get cluster resources. I sorted these resources by type. Common types are file share,Network Name,Physical disk and third party would like Volume Manager Disk Group. In order to get cluster WMI you have to specifically connect to it. You simply can’t do get-wmiobject win32_Service.

Once that happen, next code is…

Write-host “ “ –foregroundcolor “DARKRED”

Above line, I have put lots of spaces to get you DARKRED thik border.

Not much…

I can't get you the output of it, or screen shot, But you won’t be feeling sorry if run similiar in any MSCluster enviornment.

Wednesday, December 20, 2006

Daily News

Google has come with top search for year 2006, have a look.

2006 Top Searchs


Firefox version update Firefox 2.0.0.1 is available, as per them it is must to update it. With every update some or other extension stops working.Now blog this is not working for me.


God and Bad of Year 2006 and whole lot of Trends which we have almost forgotten and certainly must read Time Person of the Year:YOU

Go to Time


To make things easier and faster always use Windows Live Writer, for latest version

Go Here

 

Technorati tags: , ,

PowerShell Lab Experience

Set-ExecutionPolicy

Get-ExecutionPolicy

PS E:\> Get-ChildItem E:\PowerShell | measure-object length -Average -Sum -Maximum -Minimum

Count : 4
Average : 19491
Sum : 77964
Maximum : 37856
Minimum : 768
Property : length

-------------------------------------- 

PS E:\> Get-ChildItem E:\PowerShell | Group extension

Count Name Group
----- ---- -----
2 {MakesSense, NeedtoTry}
4 .log {Ldisk.log, process.log, properties.log, service.log}

------------------------------------

PS E:\> ((Get-ChildItem C:\WINDOWS\system32 | Measure-Object length -sum).sum)/1MB
354.373404502869

------------------------------------

PS E:\> Get-ChildItem c:\ -Recurse -Include *.tmp | select-object pspath

PSPath
Microsoft.PowerShell.Core\FileSystem::C:\WINDOWS\system32\CONFIG.TMP
Microsoft.PowerShell.Core\FileSystem::C:\WINDOWS\system32\setb6.tmp
Microsoft.PowerShell.Core\FileSystem::C:\WINDOWS\SET3.tmp
Microsoft.PowerShell.Core\FileSystem::C:\WINDOWS\SET4.tmp
Microsoft.PowerShell.Core\FileSystem::C:\WINDOWS\SET8.tmp

------------------

 

PS E:\> Get-ChildItem c:\ -Recurse -Include *.tmp | select-object fullname

FullName
--------
C:\WINDOWS\system32\CONFIG.TMP
C:\WINDOWS\system32\setb6.tmp
C:\WINDOWS\SET3.tmp
C:\WINDOWS\SET4.tmp
C:\WINDOWS\SET8.tmp

-----------------------------------

PS E:\> Get-ChildItem C:\Softwares -Recurse | where {$_.length -gt 100MB}

Directory: Microsoft.PowerShell.Core\FileSystem::C:\Softwares\SeverSupportTools\ServicePack01-Win2k3

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 14/10/2006 20:21 345322744 WindowsServer2003-KB889101-SP1-x86-ENU.exe

-------------------------------------

Get-ChildItem C:\WINDOWS\system32 | Select-Object extension | Sort-Object extension -Unique

 

-------------------------------------

 

Get-ChildItem C:\backupfiles.bak -Recurse | ForEach-Object{$D=get-date;$_.lastwritetime=$D}

Technorati Tags:

Tuesday, December 19, 2006

Power Shell Folder Size

Yesterday I was going through the Virtual Labs for powershell, and found few more powers of shell. I will posting that in different post soon, I just need to format it. Live writer from MS makes life easy in formatting blogs. Here we go. I wished to find out folder size, similiar like treesize (But not tree size)

$TotalFoldSZ=0 #total folder size
$foltree=get-childitem "C:\Program Files\iTunes" #Which fold size you wish to check out, this can be easily turn into user's by using read-host

foreach ($folt in $foltree) {

if($folt.mode -match "d") { #I used mode attribute to get only directories, so what about files in the parent directory...hmm coming to in...:-)
$fsz=((get-childItem $folt.fullname -recurse Measure-object length -sum).sum)/1MB #Got the size in MB
FSize="{0:N2}" -f $fsz #Formatted to two decimals
write-host $folt.name $fsize MB # wrote to screen FolderName,FolderSize
$TotalFSZ=$TotalFSZ+$fsize #To get the total folder size
}
}
$filesize=(($foltree measure-object length -sum).sum)/1MB #This is where I check if there are files present in the parent folder. If there are #only files then I will get folder size zero, not to miss that out, I've to include it.
$fsizeMB="{0:N2}" -f $filesize #Formatted it get in MB
Write-host Total Size of Folder is ($TotalFSZ+$fsizeMB) MB #here finally I add each folder size and files inside parent folder.

Most important thing in this script is the usage of ((get-childItem $folt.fullname -recurse Measure-object length -sum).sum)/1MB . It is just makes life easy, you get powershell to add the file size and report it.

Try this PS E:\> Get-ChildItem E:\PowerShell measure-object length -Average -Sum -Maximum -Minimum and you will be pleased to see ..yeah it gives number of files in the folder,Average size of the file and maxmimum file size and Minimum file size. Just a thing to note, you can manipulate only file items, I've to checkout if there is something which can do for folders as well.Next thing I would like someone to helpout with the sorting stuff.


Technorati: ,

Powershell to view EventLogs

I was actually expecting to see some noted difference in event viewer in Vista. If you are core System Admin your job is mostly revolved around finding out in digging logs and then relate it to some meaning full Unexpected Shutdown root cause analysis. And everytime we open event logs we normally tend to open error or warning logs around 6008, unexpected reboot. And then starts the double click attack on every event log in around...to delve in message details. I wonder if there is some better solutions planned in future OS's...just for time being I have got a work around with PowerShell, this is again one Length one liner....

Get-EventLog -LogName application where{$_.Entrytype -eq "error"} convertto-html -property timegenerated,Index,Source,Message -title "ErrorLogs" -body "Errors on Server" > log.htm;invoke-item log.htm

Lets get into details, in fact there is not much technical into, it is straight forward.

Get-Eventlog -logname Application -------with this line we are in Application log. (Just imagine how many lines you will require to get into appln log via VBSCript)

We piped it to get only error with $_.Entrytype...Hmmm I was searching for long where is eventtype embedded..in the help file.

for example: get-eventlog -logname application get-member..

finally I got it. I would like this help to be more descriptive, it says everything in greek to non-programmer like me.

With above line we got all errors. Here you again have choice how many error/Warning/Information you wish to have. Just modify first line as "Get-EventLog -LogName application -newest 10"

Once I have all errors, I asked Powershell to converto-html and with properties as Header I selected TimeGenerated,Message,Source..you select as per your requirement.

Now last step here is to re-direct the output to htm file and then invoke the same with Invoke-item.



Sunday, December 17, 2006

Power Shell's other side

Remember last time I told you powershell's power are far beyond than what you could observe in this simple blog. It is all because of .Net classes. I've to get to that level but I few pointers in that directions, Please check this link. And don't forget to open his homepage and pageflakes.com. For details check the bottom of this page.

Deployment Scenario using PowerShell

Found at Under the Stairs

Technorati:PowerShell

One Liner Saga Continues

Yesterday I read sapien blog yesterday about file age. I was amazed at the power of date formats. I was amazed by simple code

$age=($now.subtract(($file.LastWriteTime))).days

After reading, something just strike me, I though date manulation is becoming so easy, to do such a simple thing you have to all sorts of subroutines and method calls. Working in late night in office never gets me easy and happy sleep. I took that time to think about it and later in the morning I though of cracking UPtime from sysinternals via Powershell. So I began....

With below mentioned code I find out the Magic of one Liner again.

PS E:\PowerShell\MakesSense> Get-EventLog -LogName system |where {$_.eventid -eq "6005"} |sort timegenerated

Index Time Type Source EventID Message
----- ---- ---- ------ ------- -------
8237 Nov 29 19:21 Info EventLog 6005 The Event log service was started.
8266 Nov 29 19:42 Info EventLog 6005 The Event log service was started.
8299 Nov 29 20:27 Info EventLog 6005 The Event log service was started.
8497 Dec 02 13:20 Info EventLog 6005 The Event log service was started.
8553 Dec 03 03:55 Info EventLog 6005 The Event log service was started.
8591 Dec 03 12:23 Info EventLog 6005 The Event log service was started.
8632 Dec 03 15:32 Info EventLog 6005 The Event log service was started.
8666 Dec 03 22:01 Info EventLog 6005 The Event log service was started.
8740 Dec 04 22:49 Info EventLog 6005 The Event log service was started.
8818 Dec 06 11:46 Info EventLog 6005 The Event log service was started.
8843 Dec 06 16:51 Info EventLog 6005 The Event log service was started.
8897 Dec 07 10:12 Info EventLog 6005 The Event log service was started.
8957 Dec 08 13:17 Info EventLog 6005 The Event log service was started.
9803 Dec 10 21:13 Info EventLog 6005 The Event log service was started.
9859 Dec 11 14:20 Info EventLog 6005 The Event log service was started.
9933 Dec 12 14:12 Info EventLog 6005 The Event log service was started.
9962 Dec 12 20:20 Info EventLog 6005 The Event log service was started.
10025 Dec 13 11:40 Info EventLog 6005 The Event log service was started.
10077 Dec 14 14:12 Info EventLog 6005 The Event log service was started.
10154 Dec 15 14:41 Info EventLog 6005 The Event log service was started.
10551 Dec 16 22:19 Info EventLog 6005 The Event log service was started.



Now next step was to get the system uptime. I got $now=get-date

$uptime=($now.subtract(($Eve.timegenerated))).days but the next question was how I get the most recent 6005 event, time generated subtracted by current time. There was no way I can find when was last time 6005 was written. I was actually going to use bubble sort. I was stubborn of about not using it. Because somewhere I felt there is no need with Powershell, it will do that for me. And it did. After another 3 hours in struggle I realise there must be something to sort which will give me more specific result and below line cracks UPtime.

$now=get-date
$events=Get-EventLog -logname system | where {$_.eventid -eq "6005"} | sort timegenerated |select-object -last 1
foreach($Eve in $Events) {
$uptime=($now.subtract(($Eve.timegenerated))).days
$uptimeh=($now.subtract(($Eve.timegenerated))).hours
$uptimem=($now.subtract(($Eve.timegenerated))).Minutes
$uptimes=($now.subtract(($Eve.timegenerated))).Seconds
write-host $uptime Days - $uptimeh Hours - $uptimem Mins -$uptimes Sec

}

Friday, December 15, 2006

One Liner New ERA

I guess with powershell new era has started, that is all about one liners. Code which takes about min 10 lines in VBScript is reducing to one line and with much better output. below is one of the example which finds out local drive on the computer and list there properties

Power shell code

$process=get-wmiobject -class win32_logicaldisk where{$_.drivetype -eq 3}

foreach($proc in $process) {

write-host VolumeName :-> $proc.VolumeName

write-host Filesystem :-> $proc.filesystem

write-host Filesize :-> $proc.size

write-host Freespace :-> $proc.FreeSpace

Write-host ========================

}

Output is below

VolumeName :->
Filesystem :-> NTFS
Filesize :-> 20974428160
Freespace :-> 2152263680
========================
VolumeName :-> Windows2004
Filesystem :-> NTFS
Filesize :-> 39028953088
Freespace :-> 11977916416
========================

Get-WmiObject -Class win32_logicaldisk | where{$_.drivetype -eq 3} | sort size (Just one line...........)

OutPut is Below

DeviceID : C:
DriveType : 3
ProviderName :
FreeSpace : 2152235008
Size : 20974428160
VolumeName :

DeviceID : E:
DriveType : 3
ProviderName :
FreeSpace : 11977916416
Size : 39028953088
VolumeName : Windows2004

But power of powershell is explored in different ways I know. I would soon get use to it and come with more examples like this.

Technorati tags:

Thursday, December 14, 2006

PowerShell -Great Computer Shell and Not just another



I know there are lots of better and much better articles on Power shell, But still powers of powershell are so much immense that I can't resist tell you what I learnt so far.

As per Jeffery there are 5 things you must know before you start powershell

So let's start
Get-Help
Get-Command
Get-alias
Get-PSdrives
Get-Member


Any Get-Help (command name) has following option
1) Syntax reference
2) -Detail gives detail information
3) –full everything plus more examples

For example:

Get-help wmi-object
get-help WmiObject –full
get-help WmiObject -detail

Get-Help wmi -Examples out-file c:\wmiexa
(Above command get the results and push over bridge(Pipe) to out-file wmiexa.txt )

Get-command: this command not only show what command are available in PS but also can help in search any file on your C-drive. Just try get-command *.dll and see for yourself.

Get-PSDrives: one of the most daring innovations of PS. You can actually browse into registry using this command and check out what is stored over there and that too much much better format.

First run get-psdrives and then simple CD into HKLM to get into registry. If you can get into registry sure there is specific way to modify it as well.

Now Get-member, I found this command very handy. You know to get details of methods of any class, I use to run scriptomatic if it was WMI Class or move to MSDN, where every min something keep changing, so after min change link goes dead. Don’t trust me, search for Media Player SDK and get proved. But now Jeffery and his team makes this very easy. I don’t mumble out any words check the screen shot below.

One of the major source of inspiration for me to go for Power Shell , is the Dotnet class can also be invoked from here. This was lacking in VBScript and as result I was actually going to learn VB.net. Thank GOD..And Many thanks to Jeffery Hicks and his book on Powershell, Please download Powershell sample chapter to learn.

I wanna put screen but it is not getting display properly...I will put in few days on my google pages.



Monday, December 11, 2006

Daily Feeds


I found out a very good Webcast on PowerShell, Worth watching wish I get it some way downloaded for future use. It is given by powerShell Architect. And most important thing about this webcast is that it has 50 min of demo and it is very good quality video.


There is no point in giving link so take down the title of the Webcast.


TechNet Webcast: Windows PowerShell: Next Generation Command Line Scripting (Level 300) (ID:1032306183)

Wednesday, December 06, 2006

Favorites

Probably the easiest thing I do is post favorities on this Blog. Below are favorities which I use it frequently when I find nothing to do. Well guys you might be aware now even our favorites are shared and same could be used to get what others have stored in their favorities, this is achieved by utility which comes as add-on with fireFox. Well I have stored most of my book marks on Google's BookMarks, But unfortunately I don't see anyway to import it. Even in Firefox you can't export BookMarks, sounds unrealistic for me


SCRIPTING Resources

SearchScripting.com - The Scripting Search Engine
www.searchscripting.com

ScriptingAnswers.com - VBScript samples
www.scriptinganswers.com

The Script Center Script Repository
www.microsoft.com/technet/­scriptcenter/scripts/default.mspx

DevGuru VBScript Introduction
www.devguru.com

WMI and VBScript to Query Disk - Tutorial with Basic Examples
www.computerperformance.co.uk


Power Shell
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx POWER SHELL Home Page

http://blogs.msdn.com/PowerShell

Windows PowerShell 1.0 Documentation Pack


FAQ

http://www.svein.dk/Visartikler.asp?ART_id=30&S_Menu=2 (WMI Classes non English site)

http://www.windowsitpro.com/windowsnt20002003faq/




Great Resources on clustering Step-by-Step Guide to Installing Cluster Service

I would add more. may be a Monthly Activity would be better.