James O'Neill's blog

Windows Platform, Virtualization and PowerShell with a little Photography for good measure.
Posts
  • James O'Neill's blog

    WyMiwyg

    • 5 Comments

    Eileen says I'm auditory (rather than visual or Kinaesthetic ). Odd for someone who spends so much of his time on photographs ... Does she say that because words fascinate me and I think up acronyms ? I coined the word Legumetrics - I just searched for it and no one else has ever used it. Legumes are peas and beans and metrics is the anything to do with measuring and counting. Legumetrics is the science of bean counting; I wouldn't call someone a bean-counter but legumetricisit says it in a way which the accused will not understand.

    Eileen being ... Visual on this evidence ...  wouldn't have coined the term wyMiwyg.

    You know of wySiwyg - what-you-see-is-what-you-get. Eileen and my previous boss, Robin, have both talked a phenomenon which I call What-you-MEASURE-is-what-you-get. It can be a good thing. As I type, I'm in the exhausted-but-elated state that's come from doing the road-show with Steve - we had a complete revamp of how we present content because we listened to feedback and the result has been fantastic. {Next week, when I'm less exhausted I'll post more background information for the Stuff we covered on the roadshow. Keep the feedback coming for next time and stuff you want me to post.}
    But on the other hand,  Eileen and I have talked more than once about Manager X who took action Y because they were given an objective of increasing/reducing metric Z. Manager X might be outside Microsoft, or inside either in some remote division or  rather closer to our part of the organization chart. Action Y made no sense, except to meet a target - one seemingly created by someone who is themselves measured on the number of metrics they create for measuring others.

    Yesterday I read two posts of Inspector Gadget that shows that wyMiwyg is more widespread than I realized. There has been plenty of discussion in political circles about whether the "Target culture" means that schools do what their masters assess, rather than what their  teachers judge , whether hospitals treat statistics with greater importance than they do patience. Gadget explains what happens when-customer-feedback-goes-mad and explains target culture from a Police angle

    The Senior Management Team will pad softly with their hands full of paper and mugs of filter coffee towards the meeting room on the third floor...  They stop only to exchange knowing glances with the secretary and look at how we did over the weekend on the cover of the local paper.  Now they prepare to sit in judgement about events far away concerning people of whom they know nothing. There is more money in this room, more experience and more qualifications than have been deployed in the whole Division over the last 72 hours....

    I will be dressed in body armour and street gear in case something happens and I have to leave in a hurry. This mode of dress makes the others feel uncomfortably numb.
    People keep their distance in case there is a risk to be taken or a decision made. One which may effect people’s lives. Physical proximity might be enough to suggest joint responsibility....
    ....
    The Orwellian phrases swirl around the room, Citizen Focus, Neighbourhood Partnerships, Today’s Policing Today, Problem Orientated Local Solution Based Initiatives. Phantom Battalions are moved around a non-existent battlefield.

    Bonus link. If you're surprised that Policemen can write beyond the "I was proceeding down the highway when I encountered the defendant" level, then  you need to read this which Gadget linked to. I've never had that kind of a bond with an animal and it made me want to cry.; if you have, then say something, OK ?

  • James O'Neill's blog

    Load up on guns, and bring your friends.

    • 1 Comments

    The original Halo was the making of the original Xbox. It looked fantastic and sounded fantastic - spent shotgun cartridge bouncing brass end against a wall and then open onto the floor, spent shell cases from the machine gun tinkling as that bounced of the stone floor. The story unfolded like a movie, and when I say "Frankly the first encounter with the flood still scares me" anyone who's played the game nods sagely.   

    Halo 2 was great in technology terms, graphics rendering was even better, as was character AI (Marines who would drive vehicles with you as a passenger) we had dual wielding of weapons etc. But like many sequels down the years the plot was... disappointing and as is the case with many trilogies it came to an inconclusive end. Where I'd revisit episodes of original Halo over and over ("The Silent Cartographer" and "Assault on the control room"), I've never been back to most of Halo 2. Dual wielding was all fine and good but when you had a gun in each hand you couldn't melee or throw grenades. It wasn't as good to play... except in multi-player mode. That was a triumph, and it was the making of Xbox live. But if I were marooned on a desert island with one computer game I'd take the original.

    So what of Halo 3. Will the sound impress ? Will the graphics live up to the show-reel ? Will the "physics" of the elements make you forget that this is a game and make you feel like you're walking though a movie ? And when all that is mere engineering will you be desperate to know what happens next, and will the game play make me want to play it again, and again, and again. The Folks at Bungie posted a video to Xbox-live market place where they talk about that, and fine tuning the landscape to improve the play and one of them talks about making "Return of the King" the final part of Lord of the rings; the ultimate crescendo for the finale. Could they pull it off ? After playing the opening part twice now I can say yes on all counts. Much hyperbole has already been about 3, but on the evidence I've seen so far calling it a masterpiece doesn't seem unreasonable.

    Steve brought his copy of Halo 3 up to Scotland where we had an X-box for the after-hours event that's going on after our roadshow. We played co-operative mode for 4 hours on a dreadfully small screen before admitting that some sleep before delivering a virtulization event would be a good idea. We played the opening a second time in the lunch break on a bigger screen (though still in pretty low res). And I know already that there are segments like the beachhead at the start of "The silent cartographer" which will still give me the same rush at the 100th playing.

    Commercially... Well Halo 3 is the biggest launch in the history of Entertainment in the US, grossing more than $170 million dollars on Day One alone.  In a year filled with blockbuster sequels, Halo 3 still stood out, passing both Harry Potter and the Deathly Hallows ($166 million) and Spiderman 3 ($151 million). By the end of the year the Halo franchise is expected to break the billion dollar barrier across the 3 games. What can you do but be impressed ? 

    Technorati tags: ,
  • James O'Neill's blog

    Other big news 2008 RC-0 and installing Windows server Virtualization.

    • 3 Comments

    Windows server 2008 RC 0 is out! Regular readers may have noticed the link in last night's post.  

    Once you've installed it you can go to add the virtualization role in Server manager ... and you'll find it isn't available. What you need to do is navigate to the Windows folder and find a sub-folder named WSV. In there are two patches, apply them both in either order, go back to Server manager and you can add the role.

    Don't forget that you need to have a 64 bit machine, and it needs to support Intel VT or AMD-V (previously called  Pacifica) technology. On most machines you need to enable virtualization in the BIOS and do a cold boot - you must power off and on simply letting the machine reset after changing the BIOS setting won't work.

    Be aware that Server 2008 presents hardware which is different to Virtual PC and Virtual Server and if you're bringing over existing VHDs you may need to re-activate the OS

     

    If you are UK based and would like to be on the IT-Pro Momentum programme please drop me a mail with the word "airframe" in the subject. If you're outside the UK I can try to link you up with the local person in your region.

     

  • James O'Neill's blog

    Silverlight and more Halo 3 fun,

    • 1 Comments

    WarthogI posted before about use of Silverlight for the Halo3 videos - I've got to say the whole museum of humanity series is an impressive piece of work just to support Halo. There's also a an interactive manual that's well worth a look.

    I'm  disappointed to see that both Halo3.com and the root MSN Halo site use Flash where they could use Silverlight: Actually I said in a discussion that "If I worked in the Silverlight team I'd take it is a kick in the teeth...". A couple of the Silverlight team told me off for being quite so outspoken, though I'm not alone, one said

    While we appreciate the passion and support, collectively these sorts of posts seem to imply that we are either too ignorant to realize when we've been kicked in the teeth, too pusillanimous to stick up for ourselves, or we're fighting like mad behind the scenes but losing. These all assume that we have been kicked in the teeth, which is simply not true.

    OK. Fair's fair: Silverlight is still new, still building its base of developers and (as I've been keen to say myself) isn't a 1:1 replacement for Flash. So there are still places where Flash is the right tool for the job (not being a web developer I'm not the person to explain what these are vs what Silverlight's strengths are).  On a project the size of Halo3 I suspect the lead time meant they had to go mostly with a technology which was out months ago, Silverlight would have been seen as a risk. And the Flash on these sites is Good Flash - Not the the look-at-me look-at-me adverts or We've nothing to say but paid our designers a lot usage that I think of as Bad Flash.

    Over on XBox.com they've got a tool for doing your own Halo3 themes: like this one is done in Flash. Enjoy.

     

    Technorati tags: , , ,
  • James O'Neill's blog

    The truth will out...

    • 7 Comments

    Years ago, during the Browser wars I got a quote from a friend of mine (I'll call him "David", because his parents did).

    "There are two companies in this Market. One delivers less, but has a huge market share, and takes it's customers for granted. And the other one's Microsoft".

    Steve and I have been talking about Virtualization on the Road, and this week we've been to Newcastle before spending 27th September in Falkirk: we've been building Virtual-Server 2005-R2, with Clustering (using iSCSI) and System Center Virtual Machine Manager; and we've been showing "Viridian" aka Windows Server Virtualization from Windows Server 2008. At last week's events I mentioned  some information which came out at the VMWorld show earlier this month. Microsoft is number 2 to VMWare in this market; but with about 5% of companies are running production workloads virtualized, the market is still in its infancy.

    Now it's fair to say that Steve and I aren't experts on VMWare and so we try to stay out of detailed discussions about how their implementation of a given feature compares with ours. I'm much happier when customers get the facts about our product from us, and the about competitor's product from them, and make their own minds up. Talking about your competitors' products is always fraught with problems because if you say anything positive you're endorsing them which can look bad, and negative comments can look like you're rubbishing them - which looks worse. Having said that VMWare do pass comment on  Microsoft - I don't know if they feel the same nervousness, because they get their facts wrong and sometimes it seems they do so on purpose. I've already quoted Jeff Woolsey talking about the document "Licensing Microsoft Windows Server 2003 R2 to Run with Virtualization Technologies." he says

    "I don’t know about you, but I’m sick and tired of a certain company (rhymes with ZMWare) complaining that we license Windows differently for Virtual Server and third party virtualization. That’s simply not true and this document spells out the licensing most clearly.

    He also said he keeps meeting people who have been told that "Microsoft can't migrate virtual machines" by a competitor (un-named - but if you take Microsoft out of the equation VMWare outnumbers everyone else put together by more than 10:1). So we've been either demonstrating or explaining

    • Migrating Physical Machines to Virtual Machines  
    • Migrating Virtual Machines between Virtualization software (just copy the VHD, between Virtual PC, Virtual Server, Windows Server 2008's virtualization, Xen,the Microsoft iSCSI target)
    • Migrating VMs between servers under the control of System Center Virtual Machine Manager
    • Migrating VMs from a server to an SC-VMM library where they can be deployed to other servers
    • Migrating VMWare virtual hard-disks to the VHD used by Virtual PC, Virtual Server, Windows Server 2008's Virtualization, Xen,the Microsoft iSCSI target
    • "Quick Migration" using Windows Server Clustering for Fault-Tolerance - if the VM stops running the cluster service brings it up another node.

    Our experience on the Road and the experience of people on the Microsoft stand at VM world has been that Virtual Machine Manager has been well received.  It's not surprising. It's a great product in it's own right, it ratchets up what's practical with Virtualization (early next year an "R2" release will manage VMWare and Xen as well as Server 2008's native Virtualization), and it has great integration with the rest of the system center family. I've already linked to Chris Stirrat's post where we made some key announcements about pricing of SCVMM. Including the workgroup edition which will be priced at $499 US  which can "manage up to five physical host servers and an unlimited number of virtual machines.  The only restriction in the software is the number of physical hosts you can manage (5) but everything else is full functionality."

    Well VMWare have recently announced a "Special offer" on their Management product, and the free version of their Virtualization product - if you want features like clustering large memory support (read ability to run lots of VMs on one box) you need one of the pricey (upto $ 5,000) versions

     

      Microsoft VMWare;
    Failover clustering / Quick migration Yes, $0 (leverages Windows Server) No
    SAN Integration NPIV support in SCVMM No
    SMP VMS In WSV 2008, not in VS2005 No
    Servers managed 5 (with upgrade path) 3 (no upgrade path)
    Max Server RAM 256 GB (leverages Windows Server) 8 GB Cap
    Part of broader management suite? Yes (System Center) No.
    Price $499 $3630 (inc mandatory support contract)

     With that sort of pricing Windows virtualization looks very cost effective. Reminds me of David's quote.

  • James O'Neill's blog

    What happens if you break a Microsoft embargo

    • 3 Comments

    Today has been Halo3 day. Marred for me by the fact that I've been on the Road away from my Xbox, and unable to pick-up my copy. Marred too by the fact that I missed my chance to get a copy of legendary edition.

    You may have read that Argos distributed copies early. Tut, tut. The Master chief was very upset.

    argos

     

    Technorati tags: ,
  • James O'Neill's blog

    PowerShell and Telnet.

    • 1 Comments

    I've got a backlog of posts at the moment. Steve and I have been getting ready for the Road-show, and Windows deployment services, System Center Virtual Machine Manager, Virtual Server Clustering, iScsi, dual booting Windows Server 2003 & 2008, and Windows Server Virtualization mean I could be hunch over the keyboard and Windows Live writer for hours.

    I've been writing Scripts for OCS and one of the issues I've had to deal with has been remoting .It's easy enough to remotely connect to a WMI object but I can't seem to create a new instance of an object.
    This code will get me the Installed OCS components on another machine

    Get-WmiObject -query "select * from MSFT_SIPServerInstalledComponentData"-computername $server -credential $user 

    and this function will add a new server to a list maintained by OCS.

    function New-OCSEdgeInternalServer
    {Param([String]$IntServer=$(throw "You must specify an interal Server"))
     $oInstance=([wmiclass]"\\.\root\cimv2:MSFT_SIPFederationInternalServerData").createinstance()
     $oInstance.InternalServer= $IntServer
     $oInstance.put() | out-null
    }

    However the put fails if the \\.\root\cimv2 path is changed to \\serverName\root\cimv2

    PS in telnet Running PowerShell on the machine your sitting at, in order to manage a remote machine seems OK, but it does seem like some things are best run with PowerShell on the remote machine. Of course one can use Terminal services but this seems a bit heavy so I thought I would enable the Telnet service and try running PowerShell on the remote box from a Telnet Client. It works, including things which might not be too nice on a terminal: scrolling back through previous commands, tab completion and so on. The telnet client isn't quite as smart with its handling of colours as it appears in the screen shot below, and Telnet is out of favour because too much flows round the network in plain text. But that's not the point, it's another way to get a result. Now I'm trying to invent a scenario where you'd want to manage Virtual Machines, by issuing PowerShell commands in a telnet window !

     

     

  • James O'Neill's blog

    Europe ...

    • 1 Comments

    It was interesting to watch peoples reactions to the findings of the European Court of First instance yesterday.  Whilst I'm the first to admit that Microsoft is not the most popular institution in the world, it was clear that the European Union (here in Britain at least) is even less popular; one of my colleagues was reading out comments from the BBC web site - mixed in with the "Big bad Microsoft got what they deserved" and "Don't Apple lock people out of their technology" where a couple like

    • "Before the EU tells Microsoft to unbundle things from Windows, they should let me unbundle the commission from my taxes"
    • "So Microsoft didn't tell people everything that was in Windows for commercial reasons. Why do the EU keep the contents of the treaty/constitution secret"

    Of course the senior people in Microsoft were being a lot less bellicose. Bob Muglia, in an internal mail pointed out some of the collaboration we have been undertaking  with people like Novell. The following is might seem self-evident and common-sense but it's worth quoting anyway

    Ultimately, customers buy products that solve their business problems. It’s that simple. For example, both Network Appliance and EMC have licensed our file server protocols. Both companies are also building solutions that compete with Windows Server..... The customers who choose their solution do not do this because of the SMB protocol; they do this because they see advantages to the Netapp or EMC solution. Bottom line: If we want to win that business from these competitors, we need to understand the advantages that customers see in competitive solutions and build a better product.

    I'm tempted to say "Well DOH !" but the thrust of the case seemed be the exact opposite.

    Steve Ballmer also came over a lot less angry than one might expect.

    While this is a disappointing outcome, we have already been living under the Commission’s decision for more than three years, and we have taken steps to try to fully comply. We created versions of Windows XP and Windows Vista without media player capabilities, we established a licensing program for our protocols, and we paid the fine in 2004.  In addition, we’ve already adopted voluntary standards for how we integrate new features into our products in order to preserve competitive opportunities, and we continue to actively pursue interoperability because it’s what our customers need.  

    Customers need interoperability ? Remember we want our customers to have the best possible experience of our technology. Our competitors want their customers to have the best possible experience of their technology. And the customers are the same people. They want to have the best possible experience of both sets of technologies; not to be stuck on the sidelines thinking "A plague on both your houses"

    It does pose the question:  Why fight the case ? didn't what we want, and what Brussels wanted line up anyway ? Well not quite. We want to keep putting things into Windows; customers that I meet generally want us to do that too, but it's perfectly proper for regulators to be nervous that our innovations could deter others. We don't want to have our hands forced by legal action. And we want to share information because fostering interoperability is good for our business.

    Having a legal precedent which says that the biggest players aren't allowed to have trade secrets isn't a good thing. And as another poster on the BBC site pointed out - wasn't that what the whole McLaren / Ferrari thing was about ? Maybe we should ask the FIA to hear our case and McLaren should appeal to the EU.

  • James O'Neill's blog

    Colin McRae

    • 2 Comments

    Not the the game he lent his name to but the man himself.

    His helicopter crashed yesterday afternoon; there were no survivors although the dead have not been formally identified it is understood that Colin was among them.[Update. The BBC are saying that Colin, his 5 year old son, his 6 year old friend and a 37 year old family friend were on board.]

    Although my interest has always been more in single seaters; Colin's talent meant he was always special, and it was combined with a personality which made him widely liked.

    British Rallying had two great talents and great people in Colin and Richard Burns. Richard's death from a brain tumour in 2005 (I thought it was more recent) was a great loss. To lose Colin as well is ... indescribable. I've sat at my keyboard trying to put it into words ; I'll leave it to others

    At times like this we remember family and close friends of those we have lost, and how much more acutely they must feel it than we do.

  • James O'Neill's blog

    "Perfidious Microsoft"

    • 6 Comments

    I don't know whether to be angry or frustrated, and whether the target should be journalists who make mountains out of molehills, or the people in Redmond who give them the molehill to start with.

    Here's the story. The Windows update software changes sometimes. If Windows update keeps itself in a working state if is in use; that is to say outside well run IT shops which use WSUS, SMS or some other in house way of pushing out updates, and outside those people who turn the service off altogether.  Windows update logs changes to itself in the event log. However if the user has selected "Check for updates but let me choose whether to download or install them" updates to the update service don't check with the user first.

    One or two readers will go scouring everything I've ever said to find a contradiction for what I'm about to say. I don't think people should automatically trust Microsoft. I don't think they should automatically distrust us either. We need to earn trust, and sensible people will keep re-evaluating "In this case should I or shouldn't I". There are plenty of people out in the world who think no-one should ever trust us, a great many of them post on line to discussions and blogs, some write for magazines. Giving these people ammunition is stupid. And any manager in Redmond who does should be made to write out "I should never do anything which undermines public trust in my employer" 10,000 times. Preferably while sitting in a set of stocks (I'd locate these under the campus flag poles outside Building 10)

    To me, the whole premise of this argument is stupid. First off when I went to grab the screen shot I've modified here it says at the bottomWU
      "Note: Windows Update might require an update before you can update Windows"
    Granted I had to read that twice, as obviously WU can't update the OS if there are no updates, the word "Itself" should be in there. But I've been imagining a conversation with some of the people who are making this fuss, (who seem to want to the WU dialog to appear like this version)

    Me: You selected a radio button which said check for updates, so do you want it to stop checking if we change something at the server ?
    Them: No... but... WU shouldn't change a single byte on my computer without my permission !
    Me: Not one ?
    Them: Not one.
    Me: So how does it maintain a list of available updates to offer you ?
    Them: Err... Well that doesn't count, it shouldn't change Executables
    Me: So you told it to just get the list of updates
    Them: ... yes
    Me: and to take the steps that are needed to get the list ?
    Them: ... obviously, yes.  
    Me:
    Even if that means updating the software that gets the list ...

    Scott Dunn, got some key facts wrong when he started the story. He opens with
     Microsoft has begun patching files on Windows XP and Vista without users' knowledge, even when the users have turned off auto-updates.

    • "Has begun patching" ? Sounds like the latest shady activity by Redmond ? Windows update has always done it.
    • "Even when the users have turned off auto-updates" Sounds like your PC "phones home" even when you select the 'Never check for updates"  box. He means "even if you have updates set to manual"

    Having a commitment to his story which can't be inconvenienced by facts (or lack of them) Dunn turns to invention
    "Many companies require testing of patches before they are widely installed," [true] "and businesses in this situation are objecting to the stealth patching."

    Un-named, businesses object.  No. Because companies which test patches before letting be widely installed don't use Windows update. That would rely on users seeing the "New Updates are available" message and only processing the items IT told them to, when they were told. Not a system you'd rely on is it ? Over on  Microsoft watch at least Joe Wilcox got that aspect right (and did get a quote), but he downgraded it from "Stealth" (Dunns term) "sneaky", and included screen shots which reveal - shock horror - if you tell the Windows update service to look for updates, then it does start up and it records in the event log that Windows update has updated "Windows Update". Stealth ? Sneaky ? Records it's actions in the event log ? Reminds me of this story

    Meanwhile over  ZD Net Adrian Kingsley-Hughes was positively screaming "If Microsoft (or other companies) start updating systems without consent, this will lead to all sorts of trouble. On top of that, it paves the way for companies to make silent updates to technologies such as DRM and anti-piracy features." seems to me to be equivalent to saying "If Microsoft make sure users can find about new updates, that means they could smash up your system if the don't like you"  

    Kingsley-Hughes like Dunn and Wilcox (and Andrew Garcia who checked the facts for him) conveniently ignore the "Windows Update might require an update before you can update Windows" message.

    Over on the Windows Update team's blog Nate Clinton, explains what's going on. Sorry Nate, despite feeling the reporting has been pretty shabby, if it were left to me you'd be in the stocks for giving them the ammo.  

     

    Technorati tags:

  • James O'Neill's blog

    Ferrari International Assistance

    • 9 Comments

    "Ferrari International Assistance" , the FIA, the governing body of Motorsport, appear to be out of their minds.

    Anyone who can see the sense in the following, please post a comment.

    Someone in Team A sent someone in Team B a lot of information. Some of it was design related, but the recipient wasn't a designer. According to a published letter from the principal of Team B, a search of their network has shown no signs of the data; and all 140 Engineers from Team B provided statements saying they had not seen the data and no one has asserted that any part of Team B's car has been copied from the information they received.

    It is held that sender in team A did not act on behalf of his team in sending the information to his friend in team B. The pair approached team C who retreated.
    However it is held the recipient in Team B did act on behalf of his team.  

    All over Southern England I can hear people wondering if Ron Dennis sounds that much like Michael Caine, and misquoting a line from the Italian Job.

    There are a quarter of a million Italians in Britain, and they'll be made to suffer. Every restaurant, cafe, ice-cream parlour, gambling den and nightclub in London, Liverpool and Glasgow.....will be smashed. Mr. Bridger Dennis will drive them into the sea"

    Fiat sales people in the UK will be revising their sales forecasts tonight.

    Technorati tags: , ,

    Update. It seems that there was more to it than the collection of design documents.
    I'm also surprised that when I picked those 3 letters for the meaning of FIA, I was by no means the first to do so. Have a look at this from the Renault pit. http://www.f1technical.net/forum/viewtopic.php?p=36959. It seems even the teams think that of the FIA

  • James O'Neill's blog

    Feeling that you might be certifiable ?

    • 0 Comments

    In the Microsoft Certified professional sense that is. I've taken over 40 of the exams since 1993, and I haven't failed one yet so I'm a bit nervous of doing an exam that might spoil that record. More normal people worry about doing  taking the exam too early and then having to pay to take it a second time. So Microsoft Learning and Prometric have brought back Second Shot, a programme we ran last year.

    From September 15, 2007 to January 31, 2008, we are offering the chance of a free second chance to pass a Microsoft IT Professional, Developer, or Microsoft Dynamics certification exam, if you fail it the first time. Details are on Prometric's site

     

    Technorati tags: ,
  • James O'Neill's blog

    More tales from the weekend of PowerShell: a bit of a horror story

    • 2 Comments

    I mentioned my weekend of PowerShell, and that I've been working on scripts for the Office Communications Server 2007 resource kit.

    One of the things we learnt in Live Communications Server 2005 was that TLS certificates caused a lot of grief either

    • They were issued by an internal Certification Authority, which wasn't trusted.
    • Clock differences mean the certificate wasn't yet valid
    • The wrong names were on the certificate
    • The certificate wasn't marked for the right enhanced key usages.

    So one of the requests was to have a function which showed the certificate. PowerShell has a certificates provider so you can get at them... this shouldn't be too hard should it ? Ha. Ha. Ha. The function I wrote looked like something from an obfuscation contest.

    function List-OCSSipRoutingCert
    {$sn=''
     (Get-WmiObject -class MSFT_SIPRoutingSetting).tlsCertSN |
    foreach { if ($_  -lt 16) {"0{0:x}" -f $_} else {"{0:x}" -f $_} } | foreach { $sn = $_ + $sn  }
     dir cert:\localmachine\my | where {$_.serialnumber -eq $sn} | 
    format-list -property FriendlyName,Subject, Issuer, NotBefore, NotAfter,@{label="Enhanced key Usage";
          expression={$_.Extensions |
         foreach { if ($_ -is [System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension])
    {$_.EnhancedKeyUsages|foreach {$_.FriendlyName} } 
    }
    }}
    }

    The first bit is simple enough. Get a WMI object which has a property for the TLS Certificate Serial number. And  the DIR ...| Where finds the object on the CERT: "drive" with that serial number.  And  format-list will output it. But ...  foreach { if ($_  -lt 16) {"0{0:x}" -f $_} else {"{0:x}" -f $_} } | foreach { $sn = $_ + $sn  } ... what's that.

    Well: PowerShell's CERT: provider returns .NET certificate objects, and their serial numbers are strings containing big hex numbers. But the WMI object doesn't return a string for the serial number; that would be way too simple. It returns an array of integers, least significant first (that's backwards to most people) So we need to convert the integers to 2 hex digits and assemble them into a string - the assembly is done by  foreach { $sn = $_ + $sn  } , but how do I take "10" and convert it to "0A" ? It's obvious from the flow of the code that it happens in this bit:  { if ($_  -lt 16) {"0{0:x}" -f $_} else {"{0:x}" -f $_} . For all my talking about the effectiveness, no the beauty, the elegance, of PowerShell, this isn't not elegant at all. What is going on there ? 

    Technet's VB to PowerShell conversion page which I've praised before said in place of  HEX use "{$:x}" -f $_. What possesses someone to allow a string on its own to take a parameter: in my mind only functions/procedures/methods take parameters; not in PowerShell.  Could I find how to pad to two digits ?  Could I  [expletive deleted]! "{$:00}" -f $_ will pad to 2 decimal digits, but $:xx outputs "xx". Which led to me writing that ugly code.

    Maybe it is that, as I said before basic has scarred me, but it was only afterwards that it dawned on me... PowerShell strings are basically .net System.String objects;  sending one into get-member shows I have most of the methods that Visual Studio shows for system.string (padleft, trim , replace etc) but not format: I don't know why it is implemented with this -f. When I started thinking like this I thought, instead of looking for a powershell answer I'd look for a .net one, At the bottom of  MSDN's article on the System.string format method, is something which says Kathy Kam has more... and it's the only good reference I've found; too late of course, the code was done. She even has a section on leading zeros! And to put the tin lid on it all she says "Now, that we've gone through the valid specifiers, you can actually use this in more than just String.Format(). For example, when using this with Byte.ToString()"  So I didn't need to use this -f nonsense with double foreach loops. I could have written

    | foreach {$sn =  $_.toString("x2") + $sn }

    Now that - to my Basic-scarred mind - is elegant.  I've got half a dozen List-xxxxCertificate functions and I may go back and change them: this is, after all, supposed to be code that people can re-work for themselves. The format-list command has to do some pretty ugly work to find the EKU attribute of the certificate and then output each of the friendly names for it. If I do go back I'll add subject alternate names which (I think) work in a similar way.

    Two other Uglinesses I have found are worth a mention both concern remote WMI.

    One concerns calling Get-WMiobject. It takes umbrage if passed a -credential parameter when running against the local machine so I typically have code like this.

    function Get-OcsWindowsServices
    {Param($Server , $user)
     if (($server -ne $null) -and ($server -ne '.'))
        {Get-WmiObject -query "select * from win32_service where name like 'RTC%' " -computername $server -credential $user}
     else
        {Get-WmiObject -query "select * from win32_service where name like 'RTC%' "}
    }

    It occurred to me, too late on in the process to change a lot of functions, that I should probably default an empty server field to "." - the current server, and simplify the if condition. i.e.

    Param($Server='.' , $user)
    if  ($server -eq '.')  {Get-WmiObject -query "select * from win32_service where name like 'RTC%' "}
    else {Get-WmiObject -query "select * from win32_service where name like 'RTC%' " -computername $server -credential $user}

    The other is that Powershell doesn't have a New-wmiObject command, and both of the methods I've seen for creating one seem only to work on local servers. (Sits back and waits for someone to post a sample that does)

     

     

  • James O'Neill's blog

    Windows Server Virtualization beta availability (soon !)

    • 0 Comments

    I've got to admire my colleague Rick Claus over on the Canadian IT pro blog. See, While I don't have time to read my own company's press releases, Rick manages to do his job and read them. He read this one and found a quote from Larry Orecklin (Larry is General Manager for System Center and I to linked him a few days ago). Heres what Larry says:

    This week at VMworld we’re announcing that the Community Technology Preview (CTP) of Windows Server virtualization is coming soon with the initial release candidate of Windows Server 2008

    Now I can't tell you when that intial RC will be (I'll stick to Larry's "soon"). I can see lots of people installing the RC and search for the "WSV" and the like to find the bits.

    How do you get the RC? You're a technet or MSDN subscriber aren't you ? If not you don't need the RC :-)  But it should be available via beta central

  • James O'Neill's blog

    Sun to become Windows Server OEM.

    • 1 Comments

    That's a title I never expected to type. Check calendar. No it's not April 1st. I got a mail annoucing this, but it's not yet on it's now on Presspass, but and it's on Sun's home page right now with a link to "Get the news and replay audio cast"

    Considering some of the things we've said about them and they've said about us in the past - not to mention a little law suit between us - I'm off to check how many moons there are in the sky tonight: I need to check which planet I'm on.

     

Page 1 of 2 (23 items) 12

September, 2007