Welcome to The UltraTech Zone Sign in | Join | Help

Talking Out Loud with ASB

Views on Life, Technology and Everything, by ASB (aka Logik!)...

News


A little PowerShell fun...

I just had to write about this, because it is clear that is going to be a critical component of any Windows Admin's arsenal going forward.

As soon as I can get a handle on String Manipulation, I'll be a really happy camper.

Here's a quick script for enumerating shares:

$strServerList = get-content -Path C:\Temp\Test.TXT
foreach ($strComputer in $strServerList) {
    $colItems = get-wmiobject -class "Win32_Share" -namespace "root\CIMV2" -computername $strComputer
    write-output $colItems | sort-object Name | format-table -Property Name,Path,Description -AutoSize -GroupBy @{Expression = {$_.__SERVER}; Label = "Hostname"}
}

Just stick the server names into C:\Temp\Test.TXT (one server per line) and let 'er rip...

The output looks similar to:

 

Share Post:
Posted: Friday, September 15, 2006 12:33 PM by Logik!
Filed under: ,

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

About Logik!

Andrew S. Baker aka ASB aka Logik!

Andrew is an accomplished, hands-on IT Executive with a solid track record of providing timely and cost-effective business solutions using technology. With over 16 years experience in Information Technology, he has proven to be effective both as a Team Leader and as an individual contributor in designing, deploying, securing and maintaining enterprise networks.

His personal interests include Astronomy, Basketball, Bible Study, Chess, Comics, Computers, Family Life Ministries, Reading and Strategy/Role Playing games...

Some of his contributions include several whitepapers on technology and Information Security, the UltraTech Knowledgebase, various postings to technology mailing lists and forums, active participation on LinkedIn Answers, along with a number of interviews for articles published in industry magazines.

View Andrew S. Baker's profile on LinkedIn A condensed version of Andrew's current resume is available here.