PowerShell Team

Automating the world one-liner at a time…

Latest posts

Dec 13, 2008
Post comments count 0
Post likes count 0

Explore Your [Environment]

PowerShell Team

This topic is a little long but I strongly encourage you to walk through it and master the techniques it illustrates.  I can assure you that you'll will use them a couple thousand times in the next couple of years. .Net provides a wonderful class called System.Environment that tells you all about your environment.  It is well worth taking a few minutes to stop what you are doing and explore this class so that you understand its capabilities.  That way when a relevant issue comes up, you'll know that there is very simple way to get the answer.  First thing to remember is that they way you sp...

Dec 11, 2008
Post comments count 0
Post likes count 0

Gesticulating Ben Pearce

PowerShell Team

I gave a talk with Ben Pearce during IT Forum in Barcelona this year.  It was the first time I had ever given a talk with Ben as was shocked (and delighted) by his speaking style.  Ben is an awesome presenter.  Full Stop.  That said, one of his presentation techniques is to use of very energetic, very large, very expressive arm movements.  No until you understand this, you might think that Ben was having an seizure on stage.  (If you watch the first talk you see Ben starting the talk with some wild movements and when it my part of the intro - I just sorta stared at him not knowing ...

Dec 2, 2008
Post comments count 0
Post likes count 0

Get-Me.ps1

PowerShell Team

On an internal mailing list someone asked how to get the SID for the current context using PowerShell.  Chris Bellée correctly responded: ([Security.Principal.WindowsIdentity]::GetCurrent()).user.accountdomainsid.value   I used this to create a script:  Get-Me.ps1 # Get-Me.ps1 [Security.Principal.WindowsIdentity]::GetCurrent()   PS> .\get-me.ps1 AuthenticationType : NTLMImpersonationLevel : NoneIsAuthenticated    : FalseIsGuest            : FalseIsSystem           ...

Dec 2, 2008
Post comments count 0
Post likes count 0

Apologizes for the Confusion

PowerShell Team

If you visited our blog yesterday and were driven to go get a basket of "Freedom Fries" - you can relax.If you visited our blog yesterday and thought we were trying to get some class - I'm sorry to say that that is not the case.  The good news is that there is a new PowerShell blog in French at http://blogs.technet.com/powershell/default.aspx . The bad news is that for some reason, this caused our blog (MSDN vs TECHNET) to get redirected to that blog. Obviously it's fixed now.  Apologizes for the confusion. Jeffrey Snover [MSFT]Windows Management Partner ArchitectVisit the Windows PowerShell T...

Dec 2, 2008
Post comments count 0
Post likes count 0

Get-Everyone

PowerShell Team

Jeffery Snover just posted a Get-Me script.  The Get-Me script finds out the principal of the user running PowerShell.  In case you ever wanted to know how to get all of the users on a machine (or from a domain), here's a quick function that queries WMI for users. function Get-Everyone([switch]$fromDomain) { #.Synopsis # Gets all users #.Description # Queries WMI to get all users. To save time, queries # are local unless the -fromDomain switch is used #.Parameter fromDomain # If set, gets domain users as well as local accounts #.Example # # Get Al...

Nov 23, 2008
Post comments count 0
Post likes count 0

PoshBoard and ConvertTo-HashTable

PowerShell Team

I’m currently watching an cool video of PoshBoard a PowerShell based Web Portal by Pilosite available on CodePlex.   It looks great.  In the middle of the video I noticed the following script he uses to populate one of the controls on the dashboard: $ht = @{ } $objDrives = gwmi –class “Win32_logicalDisk” –Namespace “root\cimv2” |where {$_.DriveType -eq 3 } foreach ($ObjDisk in $objDrives) {     $size = $objDisk.size / 1024     $freespace = $objDisk.FreeSpace / 1024     $IntUsed = ($size - $freeSpace) * 1024     $ht.Add($objDisk.DeviceId...

Nov 22, 2008
Post comments count 0
Post likes count 0

Verbs vs Nouns by Snapin

PowerShell Team

A while ago the System Center Virtual Machine Manager team showed me a chart of their cmdlets.  It was an Excel spreadsheet which had the VERBs as rows and the NOUNs as columns.  I thought that this was a wonderful way to look at the cmdlets.  I woke up this morning and decided to write a script which would do something similar.  I’ve attached that script which accomplishes that task.  In the process, I decided that there is a good general purpose function here but I haven’t figured out what it’s name is so right now I’m just calling it ConvertTo-XXX (I’m open to suggestions).  NOTE ...

Nov 19, 2008
Post comments count 0
Post likes count 0

Step up your FOREACH Game

PowerShell Team

Last night Bruce Payette and I were interviewed on the PowerScripting Podcast with Hal Rottenberg and Jonathan Walz.  It was a blast!  There were a ton of people connected and were firehosing questions & comments in the Chat window.  There were lots of comments/discussions about Twitter.  I confessed to having never used twitter.  This morning I got an email from Jeffery Hicks recommended a site called TweetGrid which lets you "monitor the tweet stream" without a Twitter account.  (If I get an account, do I become a Twit?)  He sent me a link to a page with search...

Nov 11, 2008
Post comments count 0
Post likes count 0

PowerShell Comic

PowerShell Team

I just found THIS.  ha ha! Jeffrey Snover [MSFT] Windows Management Partner Architect Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx