James O'Neill's Blog

June 27, 2009

New Podcast available, of , er … me

Filed under: Uncategorized — jamesone111 @ 10:06 pm

I think everyone hates hearing themselves recorded, and I’m no exception. But Tony Soper though what I had to say was interesting enough to record and post, we talked mostly about the PowerShell library I’ve done for Hyper-V and PowerShell in general and broadened out to other things which are going on in the world of evangelism. I’m always surprised that people find what I have to say is worth reading, but if you’re one of those people, then you might be worth listening to.

This post originally appeared on my technet blog.

“Thumbing” Windows 7 onto Netbooks – my experience

Filed under: Windows 7 — jamesone111 @ 9:42 pm

Several posts on twitter linked directly or indirectly to an item on CNET News. It opens “Microsoft is considering offering Windows 7 on a thumb drive to allow Netbook owners to more easily upgrade their machines, a source tells CNET News.”

“Considering” can mean a great many things. I blogged about making a bootable USB stick and if you copy the DVD to a bootable stick you have all you need. I haven’t heard anyone disagree with the notion that installing Windows 7 from USB is as easy as installing from a CD, but much quicker. Give people the OS on a stick, goes the theory and not only is it a better installation experience, but they can use it for ReadyBoost if nothing else. When 7 day shop are selling 4GB drives for a fiver you have to wonder what it would add to our costs if we were buying tens or hundreds of thousands. Ironically we could probably charge an extra £10 for the convenience and add a little to our margins. So I have considered it… I don’t know how if the person CNET is reporting has controls the decision, and how serious the consideration they are giving the idea. But I’d love to see it. Here’s why.

Expansys mailed me last week with an offer on the Acer Aspire one Net book. The model is about to superseded, but it’s not bad at all. I’ve got mixed feelings about Netbooks – the ATOM processor is 32 bit and won’t even support the new XP mode on Windows 7. The thing which makes them so attractive: small size and low weight – means they have small screens. These days I take 1920×1400 for granted. The Aspire one has 1GB of RAM*, and for people who don’t value the warranty there are plenty of places showing how to remove 1/2 GB of that and put a 1GB module in it’s place – 1.5GB is the maximum, but with 2 SD card slots it’s no loss to shove a card in one (nothing sticks out so you can forget it’s there) and configure it for Readyboost, With wired and wireless networking and 3 USB sockets connectivity is good. And at £155 including VAT and delivery, we ended up getting one, primarily for my wife. After a bit of a delivery hiccup the postman turned up with it this morning.

Like most netbooks it the Acer no optical drive: I could rig one up externally, but it was quicker and easier re-jig what I had put on my memory stick and put the 32 bit ones on, and install from that: the standard [F12] to select a boot device was all I needed. Within 30 minutes of opening the box the disk was re-partitioned, reformatted and Windows 7 was on. Aero glass had enabled itself, the wireless LAN card had drivers and found my home network. Windows had updated the drivers for the Intel graphics card. The SD slot wouldn’t work for Readyboost… until new Action Center guided me to an improved driver. So a couple of clicks enabled Readyboost. Shut the lid and it goes to sleep, and it comes back in before I can count “two” AND I’d done all that in a little over 25 minutes. 

You can see where “considering offering it” came from, some people will say “Everyone should install this way”. I’m still surprised when a system finds all the right drivers without needing me to hunt them down, getting some OSes going on some hardware gives you a sense achievement at the problems you have overcome. This isn’t one, which I suppose is a good thing.

 

* Windows 7 is much happier than vista on systems with small amounts of memory , although some people will take this to extremes

This post originally appeared on my technet blog.

June 25, 2009

More PowerShell: A change you should make for V2. (#1)

Filed under: Powershell — jamesone111 @ 4:22 pm

There will be a couple more posts on changes for V2, of PowerShell but I want to get something really clear up front.

All V1 PowerShell should work in V2. Should meaning unless you have been really stupid or are very unlucky; you won’t NEED to change anything.

OK, now we’re clear on that here’s something you’re going to want to change if you ever write functions which change the state of the system…

In PowerShell V1 I had to explain to people that anything which produced results would have its output go to the console if it wasn’t sent anywhere else. Sometimes that meant explicitly writing something to the console so the user could see it without it getting merged into output that was used in another function. (See “This is not an an output”). With more knowledge of PowerShell people would discover the “Write-Verbose” and “Write-Debug” cmdlets, so the user could set a variable and get more or less output. This was good, but it meant setting a variable globally, and setting it back when you were done – unlike compiled cmdlets which could use common parameters like –verbose and –debug.  The other thing I’d explain for V1 was that potentially harmful things could take –confirm and –whatif switches. I regularly use this:
   dir *.jpg | ren -NewName {$_.name -replace "IMG_","DIVE"} –whatif
it renames photos, in this case from “IMG_1234” to “DIVE_1234” but because I don’t trust myself not to louse up the typing the bits I’m replacing I can run it with –whatif, and if that works, recall the line and delete –whatif to do it for real. Fantastic, but if you wrote a function you had to do it all yourself.

That changes in version 2 and it is really easy, here is a function which uses the new feature

Function Disable-AutoPageFile

{ [CmdletBinding(SupportsShouldProcess=$True)]
   param()
   $pc=Get-WmiObject -class win32_computerSystem -Impersonation 3 -EnableAllPrivileges
   $pc.AutomaticManagedPagefile=$false
   If ($psCmdlet.shouldProcess("Local computer" , "Disable automatic page file"))
{ $pc.Put() | out-null }
}

Easy stuff, get a Wmi object, change a property , save it back. But this turns off the Windows Page file on a server , serious stuff. So we want –whatif –confirm and so on.  The first line in the codeblock hooks the function up with the support it needs (it seems you must have a param() statement, even if it is empty when you use this) and then psCmdlet.shouldProcess does the magic so lets run the command …

PS >  Disable-AutoPageFile -whatif

What if: Performing operation "Disable automatic page file" on Target "Local computer".

PS >  Disable-AutoPageFile -Confirm

 

Confirm
Are you sure you want to perform this action?
Performing operation "Disable automatic page file" on Target "Local computer".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): n

 

Woo hoo ! I’m used to PowerShell saving me time, but how much has this just saved me ? No need put –Confirm or –whatif switches (and the rest) into the param() statement and no need to code for them, shouldprocess() tells the function if it should go ahead with the change to the system.  In fact the amount of time it would have taken to do this before meant I simply wouldn’t have bothered: now it’s so easy the only excuse for NOT doing it is if you need to keep working with V1. And bluntly, this is a reason to go to V2 at the first opportunity.

Jeffrey put up a post on pscmdlet some way back, you can modify the cmdletbinding line to match mine above and have a play with should process as well. You can see the text in the call to Should process got turned into the operation and target parts in the text, but here’s the summary of what it does with the different switches.

-Confirm Result returned depends on user input, Uses the message as a prompt
-WhatIf Always returns false, the message is displayed prefixed with What if:
-Verbose Always returns true,  the message is displayed in an alternate colour prefixed with VERBOSE

(as with write-verbose)

<none of the above> Always returns true

This post originally appeared on my technet blog.

How to: have nicer Active Directory management from PowerShell – without upgrading AD

One of the first books I read on PowerShell  had a comment about using AD from the PowerShell V1 which amounted to “It’s too hard, don’t bother use VB Script instead”. I’d taken against the book in question (no names no pack drill) – in fact it reminded me of something Dorothy Parker is supposed to have said*  "This is not a book to be cast aside lightly, it should be hurled with great force."  When I was asked to contribute to the Windows Scripting Bible (out of stock at Amazon at the time of writing!) someone had put a chapter on AD into the outline, so I had to write one. This gives me enough expertise to say it can be done, and having written scripts in VBScript to work with AD it is easier in PowerShell, but it is ugly and not done in true PowerShell style.

All that changed when we took the covers off the Beta of Windows Server 2008 R2 , it has PowerShell V2 with Cmdlets for Active directory. A quick scratch of the surface revealed these work with a new Web Service which is (you guessed it) on in R2. This quickly led to questions about whether it would be back-ported… and I had to answer “I know customers are asking for it, but I don’t know if it will happen”. There is a post on the  AD Powershell blog announcing the beta of a version for Windows Server 2003 and 2008 version for Windows Server 2003 and 2008.  

(Quick tip of the hat to Jonanthan who tweeted this)

 

 


* If in doubt about attributing quotes which don’t sound like Shakespeare or the bible, Churchill, Mark Twain or Dorothy Parker are always good bets. 

This post originally appeared on my technet blog.

June 24, 2009

How to get user input more nicely in PowerShell

Filed under: How to,Powershell — jamesone111 @ 3:48 pm

Long, long ago when I was using my first Microsoft product, I knew one way to get input from the user. The product was Commodore BASIC (in those days we wrote it in uppercase and knew it stood for Beginners All-purpose Symbol Instructional Code). and the method was INPUT. This was back in early 1979 : the user typed something pressed Enter and you could then process it. Later I learnt about GET so you could input with a single keystroke (and process it to see if the user had given you the right input). After all the myriad ways of getting input in the GUI,   PowerShell seems a bit retro (on the surface at least). But recently, I was poking around looking for something else and found that under the surface PowerShell has got some useful tricks which I’ve started to use and I’ll share here.

PowerShell has a variable $host which contains information about the program where it is running (the console host or the ISE environment). $host.ui contains a “User Interface” object which has some interesting methods

  • Prompt / PromptForChoice / PromptForCredential
  • ReadLine / ReadLineAsSecureString
  • Write  /  WriteDebugLine  /  WriteErrorLine  / WriteLine  / WriteProgress  / WriteVerboseLine / WriteWarningLine

The write ones have associated write- cmdlets, and the read ones are the basis of the read-host cmdlet. What about the prompt ones ? PowerShell has get-Credential but the  $host.ui.PromptForCredential has a couple of extra options: for example you can change the caption on the title bar and the message above the text boxes in the prompt. Like this:

$Host.ui.PromptForCredential("","Enter an account to add the machine to the domain","$env:userdomain\$env:username","")

The two empty strings are the caption, which defaults to “Windows PowerShell credential Request” and the password field; so the result looks like this.

image

What about promptForChoice ? For some time I have been using a function first named “choose-list” and now named “Select list” to fall in line with the “approved verbs” from the PowerShell team. Dan who wrote the “soliciting new verbs”  post on the team blog got in touch with me to say I ought to do this, I didn’t think what “choose” did matches the description of “select” and put forward “choose” as new verb. It didn’t get approved but at some point the definition of Select will be broadened. This works well when you want to choose from something which is naturally a table, but if you want something like PowerShell’s own prompts.

image

That is where Prompt for choice comes into play

the choices which are passed to the method are in a slightly awkward format , you need to  use New-Object System.Collections.ObjectModel.Collection[System.Management.Automation.Host.ChoiceDescription]

and for each item on the list use its Add method so the natural thing was to wrap it in a function.

Function Select-Item 
{    
<# .Synopsis
        Allows the user to select simple items, returns a number to indicate the selected item.
    .Description
        Produces a list on the screen with a caption followed by a message, the options are then
displayed one after the other, and the user can one.
        Note that help text is not supported in this version.
    .Example
        PS> select-item -Caption "Configuring RemoteDesktop" -Message "Do you want to: " -choice "&Disable Remote Desktop",
"&Enable Remote Desktop","&Cancel"  -default 1
       Will display the following
        Configuring RemoteDesktop
        Do you want to:
        [D] Disable Remote Desktop  [E] Enable Remote Desktop  [C] Cancel  [?] Help (default is "E"):
    .Parameter Choicelist
        An array of strings, each one is possible choice. The hot key in each choice must be prefixed with an & sign
    .Parameter Default
        The zero based item in the array which will be the default choice if the user hits enter.
    .Parameter Caption
        The First line of text displayed
     .Parameter Message
        The Second line of text displayed    
#>
Param( [String[]]$choiceList,
         [String]$Caption="Please make a selection",
         [String]$Message="Choices are presented below",
         [int]$default=0
      )
   $choicedesc = New-Object System.Collections.ObjectModel.Collection[System.Management.Automation.Host.ChoiceDescription]
   $choiceList | foreach  { $choicedesc.Add((New-Object "System.Management.Automation.Host.ChoiceDescription" -ArgumentList $_))}
   $Host.ui.PromptForChoice($caption, $message, $choicedesc, $default)

One of the things on my blogging backlog is the some the of the V2 features like the help text which I’ve used here. As you can see there is a lot more help than anything else, and the parameters take up more space than the business end of the code. The function will return a number, starting from zero which indicates which option was chosen. There are a couple of ways I have been using this, because two options return 0 or 1 I can easy convert that to true or false – the first one will always be FALSE. Also notice the selection character for an option is prefixed with &

PS > $enabled=[boolean](select-item -Caption "Configuring RemoteDesktop" -Message "Do you want to: " -choice "&Disable Remote Desktop", 
"&Enable Remote Desktop"  -default 1 ) 

Configuring RemoteDesktop Do you want to: [D] Disable Remote Desktop  [E] Enable Remote Desktop  [?] Help (default is "E"): d

PS C:\Users\jamesone\Documents\windowsPowershell> $enabled False

This throws up an issue though – what if the user doesn’t want to change the state ? I can have Disable , Enable and Cancel  but cancel will return 2 , and any non zero value evaluates to true, so cancel will enable remote desktop in that case! The obvious thing to do is to use a switch statement, which does nothing if the cancel option is chosen.

Switch (select-item -Caption "Configuring RemoteDesktop" -Message "Do you want to: " -choice "&Disable Remote Desktop",

                   "&Enable Remote Desktop","&Cancel"  -default 1 )
              {
                   1 {Enable-RemoteDesktop -confirm } 
                   0 { Disable-RemoteDesktop -confirm } 
              }

Enable and disable- remotedesktop are functions I’m working on , not standard powershell cmdlets. More on that another time. This is part of a menu for configuring systems and I’m making use of something I got from James Brundage (who post more on the PowerShell blog than his own these days). I don’t want to steal his thunder because it’s another technique which I’m using in lots of places and I think should go on the list of good practices.

This post originally appeared on my technet blog.

June 18, 2009

New demo videos for Windows 7 and Windows Server 2008 R2

Filed under: Uncategorized — jamesone111 @ 6:31 pm

I had a list of videos through which show many of the the new features. The scripting feels a bit clunky in the couple I’ve wantched, but as a way of introducing a feature so that you’ve got some idea what to investigate in detail for yourself they’re hard to beat.

Windows 7 Feature Overview
  Demo 1: Introducing DirectAccess
  Demo 2: Using Search Federation
  Demo 3: Using Windows PowerShell 2.0
  Demo 4: Configuring AppLocker
  Demo 5: Troubleshooting Windows 7

Windows 7 Deployment Enhancements
  Demo 1: Modifying Windows 7 Operating Systems with DISM
  Demo 2: Automating Deployment Using Windows Deployment Services
  Demo 3: Provisioning Virtual Machines

Windows 7 Manageability Solutions
  Demo 1: Configuring Group Policy
  Demo 2: Using Windows PowerShell 2.0
  Demo 3: Using Support Tools
  Demo 4: Exploring System Recovery Options

Technical Overview of Windows Server 2008 R2 Part 1
  Demo 1: Using Hyper-V Live Migration
  Demo 2: Booting from Virtual Hard Disk (VHD)
  Demo 3: Administering Windows PowerShell Remotely
  Demo 4: Using Active Directory Management Enhancements

Technical Overview of Windows Server 2008 R2 Part 2
  Demo 1: Improving Availability and Scalability with Server Core
  Demo 2: Managing Web Applications with the Configuration Editor
  Demo 3: Installing and Using the Windows PowerShell Snap-In for IIS 7.5
  Demo 4: Configuring an FTP Server with the New Administration Interface
  Demo 5: Connecting to Windows 7 Clients Using DirectAccess

Using the Windows Server 2008 R2 Migration Tools
  Demo 1: Installing Windows Server Migration Tools
  Demo 2: Migrating Active Directory
  Demo 3: Migrating DNS Servers
  Demo 4: Migrating IP Settings 
  Demo 5: Migrating DHCP Servers
  Demo 6: Migrating Local Users and Groups 
  Demo 7: Migrating File Servers
  Demo 8: Migrating Print Servers

This post originally appeared on my technet blog.

Technet virtual conference – tomorrow !

Filed under: Events — jamesone111 @ 4:28 pm

Details and Registration are at www.Technet.com/govirtual/ I’ve been told there is a great “goody bag” prize. I know what is in it, but I have been asked to keep it as a surprise – suffice to say I’d want to win it myself – I’m barred from entering of course. I’m going to be doing the on-line questions area (I missed out on some of the other bits which were planned while I was off sick). Going to interesting to see how it works. We’ve got a lot of registrations – at a physical event a lot of people milling round to ask questions deters others from queuing up I wonder how that will work in a virtual event.

This post originally appeared on my technet blog.

Fifteen minutes of fame. Not like this, thanks.

Filed under: About me,General musings — jamesone111 @ 2:10 pm

What some people refer to as “Life’s rich tapestry” has had more knots and twists in it than usual for me of late. The biggest of which was the plane crash.

We’re used to the sounds of aircraft: if you extend  the runway line of the former RAF Abingdon it passes through our village, which meant in the 1950s a stricken plane trying to land there crashed here, and in 1989 a plane taking off suffered a bird strike, crashed and skidded to a halt within sight of the same spot. The RAF moved out in the 1990s and the base is now used by the army but the RAF still take helicopters there for exercises: some days it seems like a scene from Apocalypse Now. I’ve always been interested in aviation, these days I read more accident reports than is good for me. I was in the air Cadets at school (by coincidence I did my annual camp at RAF Abingdon, and flew with the air experience flight there) I got my gliding wings; I haven’t been in glider for 20 years but I still have a fondness for them. That made Sunday seem worse.

For me it started with a sound which was somehow wrong. It was a light aircraft, not a jet, but it was here and then gone too quickly. Then there was the crash, I thought for a moment if the plane had startled my children and they’d toppled a cupboard over or something like that, but immediately my wife came in and said what it really was.  Before I could get the emergency services on the phone she was back to say a glider had crashed as well. I had three thoughts. 1. Summon help, 2. See if you can help, 3. Record the scene. I grabbed a map to give the grid reference to the Ambulance service who seemed to be getting calls from everyone in the area but weren’t getting a  clear idea of the location. The Police helicopter must have been nearby because it was on the scene while I was talking to them. There was a parachute in the sky and if I had thought about it I would have got someone to watch where it came down, I didn’t. I grabbed my camera and headed for the glider, which had come down in the field across the road, afraid of what I might find.  One wing was broken off lying beside it, the tail was missing (we assume severed in a collision) and the nose was smashed in as if it had taken the impact. My first aid skills weren’t going to be any use – although thankfully because there was no sign of the pilot –  it seemed that was him on the parachute. I took some pictures: someone was keeping people from disturbing the wreckage, so nothing I shot was going to have much value to an investigator. There was nothing I could do there. The police helicopter had landed over the road, in the field beside my house, fire engines, police cars and ambulances were arriving, the air ambulance landed close to the police helicopter. I crossed back to my house and followed the path that runs along the side of field: there’s an oilseed rape crop growing there and it’s about chest high, and all but top of the tailfin of the powered aircraft had disappeared, at a point about 150meters from my house. At first people thought that the crew had got out of this plane too. Those who’d seen it said it come down almost vertically – hence shortness of the noise – then the realization dawned that only one parachute had been seen and if that was accounted for, it could only mean the worst of all outcomes for whoever was in that plane. With no fire breaking out, and no one to rescue the Fire and Rescue service joined the police in securing the scene. An off duty policeman identified himself and went about getting names of possible witnesses. There was nothing for me to do: working on auto I shot a couple of photos of what could be seen and went indoors.

I thought someone should tell the BBC – as much as anything to tell people the roads were closed. They asked if I had pictures and I sent them one of the police chopper parked with the tailfin of the powered aircraft showing and the fire brigade wading through the crop, and another one of the glider which they used on their web site with a quote from what I had said to them: 3 other news organizations phoned me. (I’m in the phone book: it was no great detective work). I gave them the same photos: in case you’re wondering I didn’t think of asking for money and no-one offered. What I said got re-quoted by people who hadn’t spoken to me. The Mail – who phoned and asked me for the pictures credited (and I guess paid) the news agency who’d got them from me for nothing. Whoever passed the story to The Independent changed my “All you could see was the tip of the tail” to “there was metal wreckage in a field” and by the time it got to The Daily Telegraph I was supposedly describing the metal wreckage which I couldn’t see as "There were two separate heaps of it.". which there weren’t. They also credited me with counting five fire engines which I didn’t*. I feel petty for complaining about such things, given the circumstances. The BBC asked if I’d talk to them, which I did and ended up on the national evening news, and doing two bits for Radio in the morning – the chap who asked me “Are you shocked” live on air deserved withering sarcasm, but didn’t get it.

It is, to be honest, a little bit of fame I’d be happier not to have. It was the BBC camera man who told me it was an RAF training flight: it was from the same air experience flight that I had flown with all those years ago (now relocated to RAF Benson). The instructor was a local man in RAF reserve having retired from the RAF (RAF Benson has a piece detailing his great experience) and the student was an air cadet from Reading. The police – both local and RAF Police – kept the road closed for a little over 24 hours so those whose job it is could recover the bodies and the wreckage and discover what they could about how the accident unfolded, without having to worry about sight seers and souvenir hunters, and so the area could be combed for smaller bits of debris which fell away from the crash site: it seemed slightly incongruous to see the specialists from the RAF mountain rescue teams come in to do that. Their work is done now; and those of us whose lives are returning to normal will have those who are not so lucky in our minds for some while yet.

 

As I always say at the end of these non technology posts, I expect normal service to resume shortly. 

 

* I do wonder what is happening to the so called quality press. If the telegraph cut and paste my name, why not what I said, and if they want to make up a quote why assign it to a real person? I’m glad I don’t have to blog anything secretly; the Times wants to “Out” anonymous bloggers even if the public interest is to hear what they say, rather than to know who they are (see Inspector Gadget is not slow to point out the Hypocrisy of the Times seeing Iranian anonymous bloggers as good. A blogger is not without honour, save in their own country).  

This post originally appeared on my technet blog.

June 11, 2009

More on VMware and YouTube

Filed under: Virtualization — jamesone111 @ 1:30 pm

A few weeks back I posted about VMware’s conduct in posting a video which of some tests which appear to bring on a crash in Hyper-V. No company is all good or all bad, not Microsoft, not VMware. But I did say in response to one of the comments

VMware shows all the signs of running scared. The thing is, when you do that you need to watch yourself or you fall in the gutter.

Obviously no organization likes its competitors,we can (and do) respect ours. This incident  has reduced the respect we have for VMware and reading a post by Mary B on IT-Pro this week it seems we’re not alone.
Over on the virtualization Team’s blog, Jeff has a post about where this has got to: we still can’t get a crash dump out of VMware to give us a fighting chance of reproducing the problem: the tests haven’t come to a conclusion yet and Jeff doesn’t to give a preliminary conclusion – but he does says we haven’t been able to make Hyper-V crash yet but (like the folks at Anandtech point out ) we’ve found quite a lot wrong with the test which supposedly brought it on.

But …an apology has appeared from Scott Drummonds (who was the person responsible). Is it sufficient ? Is it timely ? I’ll let others be the judge of that. But there are youtube users who don’t realise that admitting you got it wrong is the first step in getting people’s respect back – and they could learn from Scott

Update. Jeff has a second post where he talks about the testing we have done where they were able to get the guest to crash. It turns out to be an issue that has less than two dozen reports but was found and fixed in April 2008. It’s not specific to Hyper-V In fact, Jeff  found that VMware reported this issue on ESX. That’s right folks, their anonymous youtube video could have shown ESX crashing as easily as it showed hyper-v.

This post originally appeared on my technet blog.

This post originally appeared on my technet blog.

June 9, 2009

Parsing lists to objects in PowerShell – Tzutil

Filed under: Powershell,Virtualization,Windows Server 2008-R2 — jamesone111 @ 5:28 pm

Last week I taught a PowerShell class – the first time in ages I’d gone back to my old role as a trainer, and of the first things we do explaining PowerShell is explain that

(a) When PowerShell’s own commands are piped together they pass object with properties – not a text representation of the objects which we’ve been used to in other shells. So when we get the contents of a directory, instead of a line of text for each item we get a file object with a name, a size and so on. 

(b) PowerShell can still run command line executables intended for the CMD shell. Output from these will be formatted text.

So… this throws up another point, the need to parse text and turn it back into an object…

 

Over on the server core blog there is post about the command line Time Zone Utility (TZutil) – which is also present in Windows 7 (so I’m guessing the whole product family), and this links to another article about it, with some PowerShell script.

I thought I’d try another approach. TzUtil /L gives a list of the time zone names and codes like this

(UTC-12:00) International Date Line West
Dateline Standard Time 

(UTC-11:00) Midway Island, Samoa Samoa Standard Time

(UTC+12:00) Fiji, Kamchatka, Marshall Is. Fiji Standard Time

(UTC+13:00) Nuku'alofa Tonga Standard Time

So I wanted to convert it to Powershell objects and the code I came up was this

$tzlist=(tzutil.exe /l) ; 0..[int]($tzlist.count/3) | select  -property @{name="TzID";  expression={$tzList[$_ * 3]}} ,
                                                                      @{name="TzName";expression={$tzList[$_ * 3 + 1]}}

The first part is simple enough – run Tzutil /l and store the result. Since the lines are grouped in 3 the next bit just counts from zero to 1/3 of the count of lines and pipes the results into select-object.  This is a corruption of what I think of as the Noble method. Jonathan Noble was the first person I saw to create a custom object by adding properties to an empty string, using select. I did the same thing and then thought “Does it have to be an empty string” ? No, it can be an integer, and it doesn’t matter if is empty or not – the number part is discarded.  So what comes out is:

TzID                                                                                         TzName 
----                                                                                         ------
(UTC-12:00) International Date Line West                                                     Dateline Standard Time
(UTC-11:00) Midway Island, Samoa                                                             Samoa Standard Time

(UTC+12:00) Fiji, Kamchatka, Marshall Is.                                                    Fiji Standard Time
(UTC+13:00) Nuku'alofa                                                                       Tonga Standard Time

Which can be used anywhere else I need it – for example in making a selection to set the time zone with Tzutil /s.

The configuration tool which I have nearly finished for server 2008 R2 Core and Hyper-V server R2 will probably get the time zone to display it on the menu using a one line PowerShell function

Function Get-TimeZone { Tzutil.exe /g}

This post originally appeared on my technet blog.

Events: TechNet Virtual Conference 19th June

Filed under: Events — jamesone111 @ 10:43 am

Technet Conference goes Virtual on 19th june, brining you IT insights and technology news from Microsoft Experts. Click to register for your place.


Andrew beat me to it, we have a virtual conference coming up: you can watch it – or any part of it on any screen with internet access. The sessions will be available on demand afterwards, but the thing that makes it an event is that on the day the speakers will be on line to field questions – just like a physical event.


The full agenda is on the registration page [Update thanks to Sean for pointing out the bad link]


But one of the strange things is we are working with the register on this one … but if you want to be in the prize draw you need to register by the end of Wednesday the 10th.


This post originally appeared on my technet blog.

June 8, 2009

Llet the [scripting] Games begin.

Filed under: Powershell — jamesone111 @ 11:51 am

The Windows scripting guys have put up the details of the first event in this years summer scripting games. Entries this year can be in VB Script or PowerShell and each of the 10 events has a  beginner and Advanced version.

I could do the advanced one in PowerShell in my head, but the “Beginner” one took a bit more work. It can still be a one liner, but (for me at least) the advanced line seems more straightforward.

You can submit scripts for the events  There are randomly drawn prizes. So if you are interested in scripting , have a go. It takes less time than a Sudoku (where the medium ones always take me more time than the difficult ones), Crossword or Game of Minesweeper / FreeCell, but hopefully you’ll learn more.

This post originally appeared on my technet blog.

June 3, 2009

A few interesting links.

Filed under: Uncategorized — jamesone111 @ 5:04 pm

I’ve got a little bit of a backlog of links which I’ve been meaning to talk about: usually I like to write a bit more than what I have below, but if I don’t clear off some of the things have been sitting as open tabs in IE8 for a while, I’ll never get round to it.

Talking about windows a series of short videos with interesting folk from the product team and some IT professionals.

One of those was about Energy efficiency – Darren sent me a link to this post of Rob’s which links to a webcast Improving Energy Efficiency with Windows 7 Power Management (it also has a link to a white paper on the same subject)

Some great customizations to Windows 7 Media center (Thanks to Sarah for the Link to that)

IEHist – a tool to dump out the history from internet explorer (ready to analyze in Powershell of course)

Since I mention PowerShell – I’m constantly impressed by Quest’s PowerGUI even though I don’t use it much. Jonathan took my Twitter powerShell scripts and turned them into a Power Pack for PowerGUI.

Xbox stuff announced at E3 ( The video of Forza Motor Sport 3 looked stunning it seems to have a film making mode Halo 3 ODST  out at the same time, with Halo reach for next year and I’m still left staggered by project Natal)

A Nice example of using Live Bing Maps for data visualization. Which constituencies have MPs which claim most expenses

And three which aren’t about Microsoft technology

A good piece on the importance of aesthetics

A rather unusual IM conversation with a scammer

Smashing apps have not one, not two but three pages of “Brilliant photos which look like they are photoshopped but aren’t”

This post originally appeared on my technet blog.

Free the Windows 7 !

Filed under: Windows 7,Windows Server 2008-R2,Xbox — jamesone111 @ 1:37 am

Brandon has a post on the Windows team blog

Windows 7 will be in stores beginning October 22nd.

I was talking a group of people a little while ago who said “In the stores in time for the Holiday season means what ? A reason margin before thanksgiving in the US ?” So this fits nicely with that enough time to stock on the shelves, sales people informed and so on. Working back from that you need at least a month, and ideally 6 weeks to 2 months to from “release” to “in stores”. We don’t have a fixed release date, because things can go wrong at the last minute, as Brandon says

Obviously, Release To Manufacturing (RTM) is an important milestone on the path to [General Availability]. We anticipate that we’ll be able to make the RTM code for Windows 7 available to our partners sometime in the 2nd half of July. We also expect to be able to make RTM code for Windows Server 2008 R2 available to our partners in this time frame as well.

So the server products will be out around the same time.

That’s also giving ourselves a decent margin for last minute problems. Ed Bott has brief post and has the decency not to say “I told you so”, because after a look at the Beta back in January he said it would release round in July. I’ve said if it wasn’t ready by August or September there would probably need to be another release candidate but if there we went from Beta to  just one RC, then July seemed about right. People are going to ask “I’m on such and such a programme, will I be able to get it between RTM and October 22”. Such things will be clarified nearer the time.

With bing getting a great press, and Xbox showcasing project natal  like this which can also do party pieces like this  and this

I feel like next year could be a vintage one.

By the way, I rarely embed You tube in my posts, that should tell you I think the video above is a bit special.

tweetmeme_style = ‘compact’;
tweetmeme_url = ‘http://blogs.technet.com/jamesone/archive/2009/06/03/free-the-windows-7.aspx&#8217;;

This post originally appeared on my technet blog.

Blog at WordPress.com.