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: , , ,

Advertisements

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 PowerShellCommunity.org (if that’s too much typing, poshcomm.org will take you to that site as well, or you can use poshcode.org 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 PowerGUI.org

New design for PowerGUI.org

New design for PowerGUI.org

PowerGUI.org 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 example.com -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:

$now=get-date
$daysSinceLastLogon=60

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: , , , , ,


My Recent Tweets

Legal

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
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

%d bloggers like this: