PowerShell Team
Automating the world one-liner at a time…
Latest posts
Get-Me.ps1
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 ...
Apologizes for the Confusion
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...
Get-Everyone
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...
PoshBoard and ConvertTo-HashTable
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...
Verbs vs Nouns by Snapin
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 ...
Step up your FOREACH Game
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...
PowerShell Comic
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
Faces From The PowerShell Community
Jonathan Medd (of the Get-Scripting Podcast) held a PowerShell Panel discussion at TechEd EMEA where he asked various members of the PowerShell community questions. I had a blast participating in this. The group consisted of: We wanted to have more people on stage but we ran of chairs! Rolf Masuch the leader of the German PowerShell usergroup was there and took this picture so now you can see the faces behind the names. Cheers! Jeffrey Snover [MSFT] Windows Management Partner Architect Visit the Windows PowerShell Team blog at: http://blog...
Expert to Expert: Erik Meijer and Jeffrey Snover – Inside PowerShell
I had a great time talking to Erik Meijer about PowerShell - what it is, how it works under the covers, why we do what we do and where we are going. You can see the interview on Channel 9 HERE. Jeffrey Snover [MSFT]Windows Management Partner ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx