Archive for April, 2008

How to create a PowerPack?

Kirk “Poshoholic” Munro has just posted a flash tutorial on creating PowerPacks (extending PowerGUI and sharing the extensions with others). He starts with basics and goes into more advanced stuff (script nodes/links/actions/dynamic trees).

Kirk has created a lot of the PowerPacks shipped with PowerGUI and shared in the library so his tips and tricks are definitely worth watching!

Check it out here!

Tags: , , , ,

Groove strikes back: Live Mesh

Am I the only one seeing that Microsoft’s Live Mesh announced yesterday is conceptually a new version of Groove?

Ever since Microsoft bought Groove in 2005 the product seemed to be a foster child in the Office family. Not included in most of Office SKUs, not really advancing the technology, lacking a clear place on the family picture (instead standing somewhat vaguely behind the really loved SharePoint).

Last week on the MVP Summit Groove MVPs applied significant pressure on Ray Ozzie and Steve Ballmer (see transcript) trying to get an answer of where Groove is going and basically not getting much. I would summarize the official vision as: Groove is becoming more integrated with SharePoint, but it will not become a complete offline solution for it any time soon, nor is there a decision whether it should.

Well, yesterday, Groove stroke back. And it is not called Groove any more – it’s Live Mesh. But just go through the screenshot gallery and you’ll see Windows folders becoming Groove-like workspaces with file sharing and sync across devices with associated members lists, news, and discussions.

In addition to the basic Groove functionality, there is also a web access page (hosted by Microsoft) and remote desktop functionality (kind of lame if the goal is to replace an application engine, but probably fine for troubleshooting and getting to your workplace remotely during trips).

So to me, Live Mesh is not Microsoft’s OS in the cloud. It is the new real Groove (as opposed to the old Groove shipped with Office) developed by the core Groove fans (including Ray himself) and having no SharePoint dependencies this time around. 😉

An offtopic for this blog, but I could not help it.

Tags: , , ,

Keep group membership under control

How do you keep group membership in your AD automatically adhere to the right lists of members (whatever “right” means in your case)? We had an interesting thread on that in the AD discussion forum and below the script which came out of it.

Basically, in Matthew’s case he is getting text files for each group listing the members which should be there (I am guessing some HR DB exports). He obviously cannot just remove everyone and recreate membership from scratch – because this can affect users (imagine if this is a DL and en email is being sent when you do this) and cause additional stress on AD. Instead, he needs to detect which users should be taken out and remove them from the group, and detect the ones which he needs to add and add them.

It turns out that with PowerShell this basically comes down to a single command (Compare-Object) comparing the file and the actual output, and an If performing the corresponding action (add or remove) based on the direction.

I am using samAccountName but you could use DN or another unique identifier. One thing to keep in mind is the -SyncWindow parameter of Compare-Object. By default it is 5. You may need to make it bigger depending on your group size.

Apart from that, everything is very straight-forward (you can obviously wrap the code into a function and use it for multiple groups):

# name of the group to update
$groupname = "Managers"
# import a file: one samAccountName per line
$users = get-Content c:\user_logon_names.txt
# get samAccountNames of current members into an array
$members = @()
Get-QADGroupMember $groupname | ForEach-Object { $members += $_.samAccountName }

# make group membership exactly as it is in the file
Compare-Object $users $members | ForEach-Object {
    If ( $_.SideIndicator -eq '<=' ) {
        "Adding $($_.InputObject) to $groupname"
        Get-QADUser $_.InputObject | Add-QADGroupMember $groupname
    } elseif ( $_.SideIndicator -eq '=>'  ) {
        "Removing $($_.InputObject) from $groupname"
        Get-QADUser $_.InputObject | Remove-QADGroupMember $groupname

The script uses Quest AD cmdlets, so you would need to have them installed and loaded either explicitly in the script (with Add-PSSnapin) or in your PowerShell profile.

Tags: , , , , ,

Microsoft working on PowerShell for AD

One of the key news from the MVP Summit is that Microsoft team has confirmed that they have PowerShell support for Active Directory in the works.

Obviously all the details are under NDA except for the fact that they are working on that – Dushyant Gill allowed us to share that.

I guess the only other thing I can tell is that it is not coming to you right away – you will have to be patient for that a little bit longer. However… 🙂 let me tell you that: whatever you learn while using Quest AD cmdlets today will be the knowledge you will be able to reuse eventually when Microsoft’s version ships. 😉

Tags: , , , , , ,

LINQ for PowerShell?

If PowerShell is the language for IT professionals in the Windows world, similar to .NET/C# getting the niche for programmers, does this mean that we should get a PowerShell way of working with databases, similar to the LINQ extensions the .NET folks got?

Joel has just posted a very good article on why the notion on PowerShell provider would not work for SQL data access.

So what is the alternative we are getting? Invoking Run-SQLCmd and supplying a SQL query is OK for SQL gurus, but is way to complex for me. After all, there are reasons why people are using AD cmdlets to manage their Active Directory instead of going the ADSI path: reduced complexity, unified PowerShell approach and not having to learn the LDAP query language. All of these apply to SQL, right?

And, by the way, I am not sure I know the answer. Like Richard, I wish SQL 2008 had more cmdlets covering all SQL administration tasks. But then, when looking at what LINQ did to .NET, I can’t help thinking that there might be yet another very elegant solution we are all missing. (Or maybe not, and like in AD, a carefully designed set of cmdlets would do the job.)

PowerShell is all about reducing the complexity and providing unified administrative approach across all platforms. I wonder what needs to be done to get this include the database world.

Tags: ,

HOWTO: Add custom cmdlets to PowerGUI

PowerGUI works great with cmdlets from Microsoft, VMware, Quest and other vendors, but what if it does not seem to “see” the ones which you created on your own?

Fear not, the issue is most likely very straight-forward and easy to resolve. Most likely you either don’t have the your PowerShell snapin selected in PowerGUI’s File/PowerShell Libraries, or you forgot to supply a help file for your cmdlets.

So here are the steps to take to make sure your cmdlets show up in PowerGUI admin console and editor as first-class citizens:

1. Make sure your cmdlets have help (creating a help file in PowerShell is very straight-forward with this utility). To check that the help is working open a PowerShell prompt and type:

Get-Help your_cmdlet_name

2. Make sure PowerGUI is using your cmdlets by going to the File/PowerShell Libraries and selecting your PowerShell snapin.

That’s it. Now if you add a node in the PowerGUI admin console all your get-* cmdlets should be there. In the editor, your cmdlets should get tooltips, intellisense, and F1 help. Your snapin is now as good as everybody’s else! 🙂

Tags: , , ,

PowerGUI Survey: Safe Mode Shortcut

As we are getting closer to the first 1.5 beta we are reviewing various pieces of PowerGUI functionality, including the shortcuts we are placing into the Windows Start Menu.

First of all, we will be adding x86 shortcuts on 64-bit operating systems so administrators can use us in both modes (this will help working with 32-bit only stuff like VMware Toolkit and various legacy systems.)

Secondly, we are considering removing the existing PowerGUI (safe mode) shortcut.

All this shortcut does is actually starting PowerGUI admin console without loading the PowerShell profiles present on the computer. We used to need this long time ago when we had compatibility issues with PowerShell community extensions. For a long time I have not heard anyone actually telling me that they were using this option, so if no one needs it, why keep it?

Please spend 5 seconds by going to the survey page and answering this simple question: do we keep this shortcut or remove it and save you some real-estate property on your Windows screen and Start menu.

If there are any other modes/shortcuts you would like us to have, please suggest these in the PowerGUI discussion forums.

Thanks in advance for your feedback!

Tags: , ,

VMware in PowerGUI

You can finally manage VMware ESX and Server from PowerGUI!

VMware PowerShell UI console

Same good stuff:

  • Bulk operations,
  • PowerShell code behind everything you do,
  • Ability to quickly jump from VMs to the actual hosted machine management.

This is really my first take on it so any feedback will be appreciated.

Go get the VMware PowerPack from the PowerGUI library!

Tags: , ,

My Recent Tweets


The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

April 2008

%d bloggers like this: