Archive for July, 2008

PowerGUI inside VI Client

PowerGUI now plugs into VMware Infrastructure Client. To be precise, starting with version 1.5.1 the setup has VMware Client Integration component which registers both PowerGUI and PowerGUI Script Editor as VI Client plugins.

PowerGUI admin console and script editor can be started right within VI Client

PowerGUI admin console and script editor can be started right within VI Client

The cool thing is that when you start them from VI client they automatically inherit your current connection to VMware infrastructure, so all your VMware management scripts or PowerGUI nodes/actions just work without asking you to connect first – no more additional prompts, having to type the password, etc. – you are already in and everything just works!

I have also updated the VMware PowerPack so it is compatible with the RTM version of VI Toolkit and PowerGUI 1.5.1 – so do not forget to download it too.

Enjoy and please submit your feedback so we keep making the pack even better!

Tags: , , ,


Exchange 2003 PowerPack!

Did you know you can do that much with PowerShell on Exchange 2003?

Did you know you could do that much with PowerShell on Exchange 2003?

We all kind of knew that Exchange 2000 and 2003 can be managed with PowerShell via WMI or AD but Jonathan Medd has just taken this to the whole new level!

His powerpack for Exchange 2003 has 53 (!) different nodes/links/actions exposing features ranging from mailbox and server management to address books and message queues.

And because this is a PowerGUI pack, you can see all the PowerShell code behind each and every item by just clicking the PowerShell Code tab, or even tweak the things a bit by going into the Properties.

This is a great piece of work obviously making Jonathan the front-runner of the PowerPack Challenge 2008 (you obviously have 2 weeks ahead to challenge this ;))

Check out the Exchange 2003 PowerPack and please let Jonathan know what you think.

Tags: , , , ,

PowerShell “CPAN”

What is the key to getting a scripting language really taking off? The number of sample scripts in that and their availability. As wikipedia claims: “half of Perl’s power is in the CPAN”.

Should we replicate the CPAN for PowerShell? No way. We should make PowerShell script repository way better. 😉 And today we have made a huge step in that direction. Starting with version 1.5.1 of PowerGUI, the script editor got a really nifty feature – ability to search for a script online right within the IDE:

PowerGUI Script Editor can now find the scripts you need in the online repository.

PowerGUI Script Editor can now find the scripts you need in the online repository.

All you need to do is:

  1. On the File menu, click Search Online.
  2. In the Search Online dialog box, type in the keywords and hit Enter.
  3. Hover over each entry for which you want to read the description.
  4. Click Download to open the ones you selected (yes, you can multiselect to open a few scripts with one click!)

This means that the great work which Joel and Hal are doing on the script repository at (if that’s too much typing, will take you to that site as well, or you can use to just go to the repository) is now at your fingertips right within the scripting IDE!

Check out the repository, and obviously do contribute to it whenever you come with something others could reuse.

Tags: , , ,

PowerGUI 1.5.1 RTMs

We have just posted the newest release of PowerGUI – version 1.5.1 – to the web. As you might guess, it got better, with most of the bugs we got reported on the community forums fixed, and most feature requests implemented. 😉

A more complete version of what’s new can be found on our version history page.

Both components got:

  • VMware Infrastructure Client integration
  • Support for roaming profiles, as well as Citrix/TS deployments
  • Easier UI localization switch right from the GUI
  • STA mode support

The highlights for the IDE include:

  • Online search for PowerShell scripts
  • Support for multiple runspaces
  • Intellisense now supporting NoteProperties, env:, and function drive
  • Support for signed scripts

Admin console got a lot of improvements for making your powerpacks easier to create and use:

  • Ability to select which parameters get prompted
  • Support for $host.ui.prompt and $host.ui.promptforchoice so you can easily create dialog boxes of your own
  • Updated default PowerPacks
  • Column selection now associated with data type and thus consistent and working for dynamic nodes

Again, the what’s new page has some details and we are out there at the forums waiting for your feedback.

Go ahead and download the latest build! (Or wait another week or so till we turn the automated upgrade on ;))

Tags: , , ,

Sys Reqs for TS Management

AD cmdlets allow you to easily manage terminal services properties for user accounts. You can get all TS attributes for a user by simply typing:

get-qaduser Dmitry Sotnikov | format-list Ts*

Get a report for a set of user by doing:

get-qaduser -searchroot mydomain.local/uk/london | format-table Name, TsProfilePath

Or change them by:

get-qaduser -searchroot mydomain.local/uk/london | set-qaduser -TsHomeDrive P:

Now, here comes the tricky part. By default, this will only work on server versions of Windows, namely Windows Server 2003 and Windows Server 2008.

To enable terminal services management on Windows XP:

To enable terminal services management on Windows Vista:

Tags: , , , , , , , ,


New design for

New design for got a facelift and is now hopefully a more enjoyable community site to use.

This is based on the survey we had on the site early this year (thanks to everyone who responded!). In the survey a lot of you told us that the navigation box we had as a webpart was hard to use and kept disappearing on some of the pages. We have changed that and went to tabbed navigation at the top of the page which should be much easier.

The wiki feature which a lot of you suggested is also live (although not integrated into the tabbed header yet).

We will keep improving the site in the future so if there’s any feedback and/or comments/suggestions – please bring them in!

Tags: , ,

Finding the latest logon time

How do you find out when was the last time a particular user logged on?

(Get-QADUser username).lastLogon looks like an obvious answer but there are a few gotchas to be aware of.

The main of them: lastLogon attribute is actually not replicated between domain controllers so if you have more than one DC (which I am sure you do) you need to get it from all of them and get the latest of them.

Here’s the PowerShell code which does that:

Get-QADComputer -ComputerRole DomainController | foreach {
(Get-QADUser -Service $_.Name -SamAccountName username).LastLogon
} | Measure-Latest

Basically, we are getting a list of all DCs in the company, then prompting each of them for the user’s lastLogon time, and then picking the latest of the values (I am using my Measure-Latest function – just copy/paste if before executing this command or put in your script.)

Note that there are utilities which can do that querying and comparison for you. NetWrix guys even have a PowerShell cmdlet described here, so you can do something like:

Get-NCInactiveUsers -domain -days 15

You should also keep in mind that if your users do not log off and simply lock their workstations they do not log on either – Kuma is describing here how he has a script logging off users every night to avoid this.

Another alternative is using lastLogonTimeStamp attribute instead. This one does indeed get replicated. It was introduced in Windows 2003 (make sure your schema is 2003-level or later). But keep in mind that this one is not real-time as it is only replicated every 9-14 days.

So as long as you are looking for users who have not logged on for something bigger than 2 weeks you should be good using Shay’s script for locating inactive users:


Get-QADUser -sizeLimit 0 | where {
  $_.lastlogontimestamp -and 
    (($now-$_.lastlogontimestamp).days -gt $daysSinceLastLogon)
} | Format-Table Name, LastLogonTimeStamp

Finally, you can speed things up considerably by constructing an LDAP query and thus doing all the filtering on the server side:

# calculate a deadline date. (now minus 60 days)
$deadline = (Get-Date).AddDays(-60).ToFileTimeUtc()

#construct a ldap query
$ldapQuery = '(|(!(lastLogonTimeStamp=*))(lastLogonTimeStamp<=' + $deadline + '))'

#run this query
Get-QADUser -Enabled -SizeLimit 0 -LdapFilter $ldapQuery

Tags: , , , , ,

PowerScripting podcast with me and Kirk

Jonathan and Hal have just posted the episode of PowerScripting podcast in which Kirk and I joined them to discuss a bunch of topics from the ever green providers vs. cmdlets to our favorite PowerShell v2 features and latest PowerGUI news. Enjoy the show!

Tags: ,

Measure-Latest: finding latest date/time

Today I needed to find the latest date/time value from a set of values and stumbled upon an issue with the standard measure-object cmdlet failing for DateTime values (click the link to vote for this to be fixed by the way).

Obviously, as a true PowerSheller, whenever I come across a limitation like that I simply use the extensibility of PowerShell to get through. Here’s the Measure-Latest function which I created. It takes the values from the pipeline and outputs the latest of them (or $null if the pipeline was empty or only had $null values):

# get a set of DateTime values from the pipeline
# filter out $nulls and produce the latest of them
# (c) Dmitry Sotnikov
function Measure-Latest {
    BEGIN { $latest = $null }
            if (($_ -ne $null) -and (($latest -eq $null) -or ($_ -gt $latest))) {
                $latest = $_ 
    END { $latest }

Usage is pretty simple:

# when was the last time something was modified in the current folder?
dir | foreach { $_.LastWriteTime } | Measure-Latest


Tags: , , , ,

QAD Cmdlets Online Reference

We have just finished uploading all the QAD cmdlets help information to the PowerGUI Wiki site: so here it is now: QAD cmdlets online reference. Finally every QAD cmdlet got a web page of its own!

And, as I already mentioned, these are wiki pages – so if you spot an error or have a killer example to add – just be our guest. 😉

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

July 2008

%d bloggers like this: