All posts filed under: Windows

Accessing Windows Imaging Application Platform Interface (WIMGAPI) in PowerShell

If you have used the Deployment Imaging Servicing Management (DISM) cmdlets in Windows 8 (Server or Client), you would have quickly realized that the functionality is limited only to certain basic tasks around image servicing and tasks such as capturing a WIM image and applying WIM image are still with dism.exe. So, we still need to use dism.exe when we need to perform some of the advanced tasks as I mentioned here. Now, it may not a very suitable solution when you want to do everything using PowerShell. Of course, you can wrap dism.exe in PowerShell but in my opinion, that is not the best way! I prefer everything PowerShell as long as possible.

Microsoft Virtual Tech Days: Monitoring & Managing remote Windows 7 desktops with PowerShell – Slides & Scripts

Early this month, I did an online webcast session for MS Virtual Tech Days. This session was around how administrators can manage remote Windows 7 desktops with Windows PowerShell. Here are the slides from that session …. ..and the scripts I used for the demos. The session recording will be available soon. I share it here as soon as it becomes available.

PowerShell to list / add / remove Windows roles & features remotely

Lot of my R & D work at home happens on a couple of physical systems and lot of virtual machines hosted on Hyper-V. One thing that I regularly do is to rebuild lot of these machines and in that process, I add/remove Windows OS features many times. One default setting I have on all my systems is PowerShell remoting. This helps me access any system from a central location to add / remove these Windows features. I have been using PowerShell remoting combined with Server Manager cmdlets in Windows Server 2008 R2. But, every time I want to enable/disable a feature, there is lot of typing. So, I ended up writing my own wrapper for doing this remotely using three functions or cmdlets — whatever you call it. These functions have been tested on Windows Server 2008 R2 and ServerCore R2 OS. ServerCore is a bit tricky though. We don’t have PowerShell enabled by default. So, we have to manually enable Windows PowerShell feature using OCSetup. Only then, we can use this script for …

Managing Windows Deployment Services (WDS) using PowerShell – Part 1

I just can’t believe that I have not written anything here for a month. There were several things that happened last month and I did not really have any energy left to write some content here. There were several interesting things I learned and experimented. Now that I am done with quite a few things, I will start (hopefully.!) writing regularly.  I will also resume the WQL series shortly. I regularly use Windows Deployment Services (WDS) to deploy OS in my lab environment. I used WDSUtil.exe a bit to automate a few aspects of this work. However, WDSUtil spits out lot of text and using this for automation isn’t really good idea. I can use PowerShell to parse the output but it is not worth the effort. It is not easy to objectify the output of WDSUtil using PowerShell. There is a lot of flexibility in using objects than simple text. I strongly believe in “everything PowerShell” when it comes to automation. So, I started looking at Windows Deployment Server COM object model to see …

Programming Windows 7 taskbar using Windows API code pack and PowerShell

Windows® API Code Pack for Microsoft® .NET Framework provides a source code library that can be used to access some features of Windows 7 and Windows Vista from managed code. These Windows features are not available to developers today in the .NET Framework. Windows 7 Taskbar Jump Lists, Icon Overlay, Progress Bar, Tabbed Thumbnails, and Thumbnail Toolbars Windows Shell Windows 7 Libraries Windows Shell Search API support Explorer Browser Control A hierarchy of Shell Namespace entities Windows Shell property system Drag and Drop for Shell Objects Windows Vista and Windows 7 Common File Dialogs, including custom controls Known Folders and non-file system containers DirectX Direct3D 11.0, Direct3D 10.1/10.0, DXGI 1.0/1.1, Direct2D 1.0, DirectWrite, Windows Imaging Component (WIC) APIs Windows Vista and Windows 7 Task Dialogs Sensor Platform APIs Extended Linguistic Services APIs Power Management APIs Application Restart and Recovery APIs Network List Manager APIs Command Link control and System defined Shell icons That is quite a bit. Being able to access these features from .NET makes it the best candidate for PowerShell too. When I …

Refreshed home PC setup

With the recent release of Windows 7 & Windows server 2008 R2, I wanted to refresh how / what I need to install on my home PC. I received this PC with Windows Vista pre-installed and I was never a big fan of that OS. I have always been using Windows Hyper-V server 2008 and running various other operating systems as virtual machines on top of it. With the native VHD boot support on R2, I got a new usage model. Here is how it looks now  So, as it is shown in the diagram above, I am using Hyper-V Server 2008 R2 as the base OS. On top of it, I have Windows 7 and Windows Server 2008 R2 configured to boot using native VHD support. Note that they are not virtual machines. So, I will be able to see these two OS entries in the boot manager menu when I boot up the system. I will be able to use the complete physical machine capability when I boot these OS VHDs. I also …

Poor man’s P2V just got better; disk2VHD 1.1 is available

A week back I wrote about a new sysinternals tool called Disk2VHD. After the initial 1.0 release, many people have expressed the need for having command line support. Sysinternals team listened to all of this. They just released disk2vhd 1.1. You can now use the following options to perform p2v from command-line. Usage: disk2vhd <[drive: [drive:]…]|[*]> <vhdfile> Example: disk2vhd * c:\vhd\snapshot.vhd Where can you use this option? I can think of many possibilities. You can now use a simple script to walk through all of your systems in the data center and capture all physical hard drives as VHD files. Imagine being able to run this immediately after sysprep to capture the sysprep’ed system volume as VHD file. You can use that as a master image for both physical and virtual machines I will write about the second option sometime soon..Stay tuned.

Hyper-V: VHD Shell Extensions, updated release

I just posted a batch file wrapper around VHD Shell Extensions to find stale VHDs on a Hyper-V Server. However, because of VHDShellExt.vbs design, it will always try to find if the given VHD is associated with a VM on the local Hyper-V machine. One problem with this design is, you need to use the script on all the Hyper-V server machines you have to find any stale VHDs.  I have updated VHDShellExt.vbs to add /Server switch to be able to use it from a non Hyper-V system too. Now, using this new switch you can use the script from even a Windows Server 2003 or Windows XP system.  You can download the new release here Here is the updated documentation for this release