Tag Archives: Lee Holmes

The current and future state of the Windows Management Framework

At the 2nd of October, Lee Holmes gave a presentation about the current and future state of the Windows Management Framework (WMF) during the Dutch PowerShell User Group (DuPSUG) at the Microsoft headquarters in The Netherlands.

The slide decks and recorded videos will be made available soon, but this is what was discussed:

The release cycle of the Windows Management Framework (WMF)

Faster incremental releases of preview versions are being released. This rapid development means that companies that need specific new functionalities to tackle current problems they’re having, don’t have to wait as long as they had to in the past.

Everyone should keep in mind that documentation for preview versions can be more limited, but should still read the release notes carefully. They contain descriptions of some of the improvements that are discussed in this blog post, but also cover other things that aren’t discussed here. Also be sure to take a look at What’s New in Windows PowerShell at TechNet.

A request from the audience was to include more helpful real-life examples until documentation is fully up-to-date.


Desired State Configuration (DSC) partial/split configurations

With DSC partial/split configuration it is possible to combine multiple separate DSC configurations to a single desired state. This could be useful when a company has different people or departments that are responsible for a specific part of the configuration (by example Windows, database, applications).



OneGet is a Package Manager Manager (it manages package managers). It enables companies to find, get, install and uninstall packages from both internal and public sources. Public repositories can contain harmful files and should be treated accordingly.

Besides the OneGet module included in the Windows Management Framework Preview, updated versions are continuously being uploaded to https://github.com/OneGet/oneget by Microsoft. These can include bug fixes and new functionality like support for more provider types.

While in the past it seemed that Nuget was required, during the PowerShell Summit it was demonstrated that a file share can be used as well.

From the audience a question was raised whether BITS (Background Intelligent Transfer Service) could be used. This is currently not the case and there were also no plans yet to implement it.



PowerShellGet is a module manager which should make it easier to find the many great modules that are already available, but are not very discoverable because they’re fragmented on numerous websites across the Internet.

Microsoft is currently hosting a gallery of modules. The modules that are available in there are currently being controlled by Microsoft, but this might change in the future.

It is possible to create an internal module source and the save location for modules can be specified as well.



PSReadLine is a bash inspired readline implementation for PowerShell to improve the command line editing experience in the PowerShell.exe console. It includes syntax coloring and CTRL+C and CTRL+V support, for more information about other improvements, view their website.

PSReadLine is one of the modules that can be installed using PowerShellGet:
Find-Module PsReadLine | Install-Module



  • Always be careful when running scripts that include Invoke-Expression or its alias iex because it might run harmful code.
    • For a non harmful example, take a look at this blog post by Lee Holmes.
  • Many people in the security community are adopting PowerShell.
  • PowerShell is done in memory and is therefore volatile. To improve security the following enhancements were introduced:
    • Transcript improvements
      • Transcript support was added to the engine so it can used everywhere, also in the Integrated Scripting Environment (ISE).
      • A transcript file name automatically includes the computer name.
      • Transcript logging can be enforced to be redirected to another system.
      • Transcription can be enforced by default.
  • Group Policy
    • An ADMX file is currently not available to configure it on all platforms, but it can be found in the technical preview versions of Windows 10 and Windows Server under: Administrative Templates -> Windows Components -> Windows PowerShell
  • More advanced Scriptblock logging
    • Enable ScriptBlockLogging through GPO (in later Windows versions) or by registry by setting EnableScriptBlockLogging to 1 (REG_DWORD) in: HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
    • The additional logging will show you what code was run and can be found in event viewer under Applications and Services Logs\Microsoft\Windows\PowerShell\Operational.
    • Scriptblocks can be split across multiple event log entries due to size limitations.
    • Using Get-WinEvent -FilterHashTable it is possible to get related events, extract the information and combine it.
    • Since attackers would want to remove these registry settings and clear event logs, consider using Windows Event Forwarding/SCOM ACS to store this information on another server. Also consider enabling cmdlet logging.
  • Just Enough Admin (JEA)
    • JEA enables organizations to provide operators with only the amount of access required to perform their tasks.


New and improved functionality and cmdlets


Manage .zip files using Expand-Archive and Compress-Archive

.zip files can be managed using Compress-Archive and Expand-Archive. Other archive types like .rar are not currently supported, but this might be added in future versions.



It is now not necessary anymore to specify the item type. To create a new item, simply run
New-Item foo.txt



This makes it easier to get the value of a file or registry:

  • Get-ItemPropertyValue $Env:windir\system32\calc.exe -name versioninfo
  • Get-ItemPropertyValue-PathHKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\ScriptedDiagnostics -Name ExecutionPolicy


Symbolic links support for New-Item, Remove-Item and Get-ChildItem

Symbolic link files and directories can now be created using:

  • New-Item -ItemType SymbolicLink -Path C:\Temp\MySymLinkFile.txt -Value $pshome\profile.ps1
  • New-Item -ItemType SymbolicLink -Path C:\Temp\MySymLinkDir -Value $pshome

Junctions cannot currently be created, but this might also be added in a later version.


Debugging using Enter-PSHostProcess and Exit-PSHostProcess

Let you debug Windows PowerShell scripts in processes separate from the current process that is running in the Windows PowerShell console (by example long running or looping code). Run Enter-PSHostProcess to enter, or attach to, a specific process ID, and then run Get-Runspace to return the active runspaces within the process. Run Exit-PSHostProcess to detach from the process when you are finished debugging the script within the process.


Use Psedit to edit files in a remote session directly in ISE

Simply open a new PSSession to a remote computer and type PSEdit <path to a file>.


Classes and other user-defined types

    • The goal is to enable a wider range of use cases, simplify development of Windows PowerShell artifacts (such as DSC resources), and accelerate coverage of management surfaces.
    • Classes are useful for structured data. Think by example about custom objects that you need to change afterwards.
    • Name of the class and the constructor must be the same.
    • Code is case insensitive.
    • In classes, variables are lexically scoped (matching braces) instead of dynamically scoped.
    • Every return must be explicit.
    • Sample code:

Class MyClass
  MyClass($int1, $int2)
        “In the constructor”
       return 42








Up Next: Lee Holmes!

We are very pleasd to have Lee Holmes on the show once again! Lee, as many know, is a long-time member of the PowerShell development team at Microsoft, and the author of the PowerShell Cookbook which is now in its recently released third edition. Here’s more from his bio:

Lee Holmes is a developer on the Microsoft Windows PowerShell team, and has been an authoritative source of information about PowerShell since its earliest betas. His vast experience with Windows PowerShell enables him to integrate both the ‘how’ and the ‘why’ into discussions. Lee’s involvement with the PowerShell and administration community (via newsgroups, mailing lists, and blogs) gives him a great deal of insight into the problems faced by all levels of administrators and PowerShell users alike.

As always, join us live at 9:30 PM EST Thursdays at live.powerscripting.net!

Up Next: Cooking Up PowerShell with Lee Holmes!

Book cover of Windows PowerShell CookbookThis week’s show should be really great as we welcome back Lee Holmes from the Microsoft PowerShell team to talk about his book: Windows PowerShell Cookbook, Second Edition, from O’Reilly!

We will have several copies of the ebook to give away, so be sure to show up for the live stream this Thursday at 9:30 PM EDT on ustream. Once the recorded show hits the blog we will announce how you can win a copy if you can’t catch us this week.

Update: Lee is on tonight’s show! (9/9/2010)

Books All Gone!

Many thanks to O’Reilly for providing so many copies of Lee Holmes books.  We gave away four copies each of the PowerShell Cookbook and the PowerShell Pocket Reference.

Also, we wanted to remind you that there’ll be no show released next week because we’re taking a break this week for the Thanksgiving holiday in the US. Next PowerScripting Live will be Dec 4th at 9pm EST. See you there!

Episode 48 – Lee Holmes

A Podcast about Windows PowerShell.


In This Episode

Today on the PowerScripting Podcast we interview Lee Holmes, author of Windows PowerShell Cookbook and developer on the PowerShell team.  And as usual we’ve also got news, tips, resources and more.


When it comes to scripting, you’re a warrior. But mighty warriors need mighty tools!

For awesome PowerShell scripting, nothing matches the might of Quest’s PowerGUI. Versatile and easy to use, PowerGUI helps you build commanding scripts that leverage PowerShell’s strength across the enterprise. Now, ruling your domain is easier than ever.

Is your scripting might equal to the challenge? Put the power in your hands – download PowerGUI today.


Admin Script Editor (which recently received Windows IT Pro’s top award) provides a true integrated scripting environment for PowerShell.  Advanced features include an integrated PowerShell debugger, advanced code generating tools for Active Directory, Databases, XML files and more.  Let’s not forget about the exclusive PowerShell forms designer.  Come see for yourself– Admin Script Editor v3.5 is availble for a 45 day trial at AdminScriptEditor.com.

We had a great interview with Lee Holmes, be sure to listen. You can find his blog at leeholmes.com/blog, and also check out his books!


This segment is brought to you by Idera:

Want to make Windows PowerShell easier than ever to learn and master? Checkout Idera’s PowerShellPlus Professional Edition which is now available for download! The new version has vastly improved code completion and a slick interactive Learning Center. Go to www.idera.com/PodcastPeople to get your copy today!


Challenge / Book Giveaway

  • If you’d like to win a copy of one of Lee Holmes books, simply leave us feedback on iTunes, Podcast Alley, or on your own blog. We have four books to giveaway! Send an email to [email protected] letting us know where to see your review.
  • Don’t forget our challenge from two shows ago.  If you submit a solution, we’ll feature it on the show and the website, and you’ll get a little something for your trouble.  :)  Here is the email from Dale which we forgot to put in last week’s show notes:

“While trying to find a solution to a problem that popped up at work, I stumbled upon an open-source dotnet object-oriented database called Db4o.  It is intended to be used as an embedded database in programs where some persistent storage is needed, but instead of storing data in related tables, it stores objects.

I’ve tried to access the functions via reflection, but I am just learning Powershell and I don’t know if this is the right technique.  I haven’t gotten very far.

I was wondering if you or someone else who listens to the show could take a look at it, and see if it can be useful as an object store in powershell scripts.”

Coming up on the PowerScripting Podcast

  • Episode 48: Lee Holmes (we ran out of time, so we’ll be having him on again for sure)
  • Episode 49: Susan Bradley, Small Business Server MVP (PowerScripting Live starts at 8:30 EST @ 11/13)
  • Episode 50: The Scripting Guys! (PowerScripting Live will be Wednesday the 19th @ 9pm)

Win a Copy of Lee Holmes’ Books This Thursday

O’Reilly was kind enough to provide us with several copies of both Windows PowerShell Cookbook, and Windows PowerShell Pocket Reference to give away on the show. We’ll give away one or two during this Thursday’s PowerScripting Live event (at 8pm this week instead of the usual 9pm), and we may save some to give away to those aren’t able to watch the live stream.

So please join us this Thursday and ask questions of Lee Holmes and you may win one of his books!

image image

Episode 15 – Joel Bennett, for the developers in the house

A Podcast about Windows PowerShell.


In This Episode

  • Special guest this episode, Joel Bennett aka “Jaykul” from HuddledMasses.org
  • “The Developer Show”
  • New software releases, interviews, other goodies


  • AD Cmdlets RTM (Dmitry’s PowerBlog)”We kind of kept sticking to the fashion of perpetual betas for quite some time now (since the first 1.0 beta released late March through the RC 1.0.5 this fall) and we feel that the product is now feature rich and stable enough…”
  • Windows PowerShell Holiday Gift Guide: Books (Technet Scripting Center)”The Scripting Guys present their first-ever Windows PowerShell Holiday Gift Guide. In this inaugural gift guide we survey some of the best PowerShell software, script editors, cmdlets, and add-ins that money can buy.”
  • An Interview with Lee Holmes (Technet Scripting Center)”Lee Holmes is a developer on the Windows PowerShell team and author of the new book Windows PowerShell Cookbook (which includes a foreword written by Scripting Guy Dean Tsaltas).”
  • An Interview with Lee Holmes (A Couple of Admins Podcast)
  • Cisco opening up IOS (Network World)”Cisco’s plan to open up its venerable IOS routing software to customers and third-party developers is a bold move designed to further the company’s push to make the network the epicenter of the virtual data center.”



  • Discussion on an email from listener John Cook:

“I’m a programmer, so I don’t find PowerShell (or VBScript etc.) difficult as a language. What I find difficult about scripting is scripting itself, such as recognizing when it’s worth the effort to write a script. I’m a big fan of scripting, but I don’t write a lot of scripts because I don’t think to do it. Or I’m doing something that’s not repetitive enough to script.

I would find it interesting to listen to a show about scripting strategy: organizing tasks so they can be scripted, etc.

I would also find it interesting to hear a discussion about testing scripts. I’m a fan of test-driven development, but scripts are hard to test. Scripts are full of side effects: creating or deleting files, setting properties, sending email, etc.”

  • Discussion with Joel about his new Windows Automation Snapin for PowerShell (WASP)
    • Blog post: http://huddledmasses.org/window-gui-automation-from-powershell/
    • New Codeplex project: http://codeplex.com/WASP
    • This is basically an upgrade to the Win32.Windows snapin Joel released a while back, the one thing that’s missing in this release that was possible in that one is using frame-set definitions to position windows. That will make it back in eventually, but in the meantime, I present some major new additions which add up to the ability to do 90% of what you’d want to do in testing or automating your winforms app’s UI.
  • Also covered: Joel’s experiences developing a Windows Presentation Foundation (WPF) PowerShell host.


(new-object -com SAPI.SpVoice).Speak("Hello $($env:UserName)",2)

Episode 4 – Get Data and Format the Output

A Podcast about Windows PowerShell.


  • New PowerShell book in the works “Windows PowerShell: The Definitive Guide” by Lee Holmes’ (a developer on the PowerShell team) from O’Reilly they have an early access program http://shrinkster.com/p8l
  • Windows Server 2008
  • AD Cmdlets 1.0.2 released – http://shrinkster.com/p8e
    • Support for Vista and Server 2008
    • You now have the ability to create enabled user accounts
    • Dmitry’s PowerBlog – http://shrinkster.com/p8d

Cmdlets of the week

  • Get-content (GC, type, cat)
  • Format-List (FL)
  • Format-Table(FT)


  • Free PowerShell ebook
    • Published by Microsoft Switzerland and recently translated into English due to it’s great popularity
    • Subtitle is “An introduction to scripting technologies for people with no real background knowledge”
    • 44 pages
    • http://shrinkster.com/pau


  • Get started now, jump in – PowerShell is your hammer and you are looking for nails
  • Go through the free manual, work the labs


  • $time = [datetime]::now
  • $time | gm   there is a method called addDays
  • $time.addDays(-90)
  • [datetime]::now.addDays(-90)  – we are calling the static member “Now” from the type literal [datetime]  to see this use [datetime] | gm -static  you will see things like “now” and “today”
  • or you could use (get-date).adddays(-90)

Powershell challenge

  • Use PowerShell to find all of the files or folders in the current directory where System does not have Full Control