All posts filed under: References

Using Write-Progress cmdlet with BITS file transfers

As you may know already, I released my first PowerPack for PowerGUI sometime last week. I am currently looking at various other features I want to add to this powerpack. One such feature is displaying progress information for each file transfer. While trying to figure out how I can implement this within PowerGUI Admin console, I came across a nice cmdlet Write-Progress which is used to show progress bars. Though this is a nice cmdliet, I can not directly use this in the powerpack. However, I want to show how to use Write-Progress cmdlet with BITS file transfer. To load BITS file transfer PowerShell cmdlets Import-Module BitsTransfer To start File Transfer $bitsJob = Start-BitsTransfer -source http://download.microsoft.com/download/7/8/A/78ACCE4D-D1DD-4E54-80DA-928DCFD3AD6A/OfficeServer.exe -destination “C:\SharePoint” -Asynchronous To view the progress, $bitsJob | ForEach-Object {  while ($_.JobState -eq “Transferring”) {   $pctComplete = [int](($_.BytesTransferred * 100)/$_.BytesTotal);   clear-host;   write-progress -activity “File Transfer in Progress” -status “% Complete: $pctComplete” -percentcomplete $pctComplete   sleep 10;  } }  This is it. You will see a progress bar at the top of PowerShell window as shown here. If you close and open …

Sysinternals’ new tool disk2vhd a.k.a poor man’s P2V

I am a big fan of sysinternals tools and I use these tools quite often to debug OS related issues. These tools are quite useful when you want to understand internals of OS. Mark and his team has been doing a great job in keeping these tools up to date and adding new features once in a while. One such new tool that got released yesterday is Disk2VHD. You can download it here. Here is how TechNet link decribes this new tool. Disk2vhd is a utility that creates VHD (Virtual Hard Disk – Microsoft’s Virtual Machine disk format) versions of physical disks for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs). The difference between Disk2vhd and other physical-to-virtual tools is that you can run Disk2vhd on a system that’s online. Disk2vhd uses Windows’ Volume Snapshot capability, introduced in Windows XP, to create consistent point-in-time snapshots of the volumes you want to include in a conversion. You can even have Disk2vhd create the VHDs on local volumes, even ones being converted (though performance …

The case of Internet Explorer crash

This is yet another post in the “case of ..” series of articles. This is about an IE7 crash I was facing when I tried to open a time sheet application. Every time I open IE and log in to the time sheet application, IE will close with no error message. Now, this can be hard to even troubleshoot when there is no error message. But not on Windows — We have the help of Sysinternals tools. So, I opened Sysinternal’s ProcMon and filtered out for events from iexplorer.exe. At this point, I just tried to reproduce the issue of IE crash. After I had the repro, I saved the ProcMon capture and started looking at the events. There was nothing really suspicious in the capture mostly because there was nothing wrong with iexplorer.exe. Now, I wanted to find out if there is any thing interesting just before the iexplorer.exe process exit. For this pupose, I created another filter on the operation “Process Exit”.  Now this will filter out all events except the process exit event. …

The case of delayed run dialog initialization

Yes, I got inspired by Mark’s “the case of” series and hence the title of this post. I use a Windows Vista laptop at work and was facing an issue when I try to open Run dialog either by clicking on Start-> Run and pressing Windows + R key combination. It used to take more than 10 seconds to open up. I always wanted to see what was going wrong but never really cared to do that until it became really frustrating yesterday. So, I decided to use Sysinternal’s ProcMon to start my investigation. But before that I need to know what process to monitor. This is essential because process monitor gives lot of information all of which may not be really relevant to the issue I was facing. My commonsense and little bit of OS internals knowledge told me that it should be explorer.exe. To verify that it was correct, I opened Run dialog and then open Task Manager. Now, when I right-click on Run in task manager and select Go to Process, it …

Proxy authentication in a VBScript

While experimenting with Twitter API using VBScript, I was unable to access as the script was not authenticating to the proxy server inside the corporate network. I was using XMLHTTPRequest object initially and found out that there is no way I could authenticate to a proxy when using this object. I quickly looked at WinHttpRequest object and it provides a mechanism to set the proxy credentials. I thought it is worth sharing that here.

The overall output of this script will be 20 recent replies to your Tweeter account in XML format. That may not be really useful to you but I just wanted to describe how the proxy server authentication can be done using VBScript. Technorati Tags: Twitter,Twitter API,Scripting,VBScripts

Hyper-V: Notes on differencing disk usage

I came across a few issues while doing some scripting work related VHDShellExt project. In this series, I will list a few issues I found around differencing disk usage. First one: Adding differencing disk as a new VHD to an existing VM If that section title is too complex to understand, here is the step-by-step of what I tried. One assumption: You have integration components installed inside the guest OS. Right-click on a VM and select settings Select “IDE Controller 0”, select “Hard drive” on right pane and click “Add” In the subsequent window, click on “New” In the “New Virtual Hard disk” wizard, select “differencing disk” and click “next” Give it a name and location and click “Next” On the “configure Disk” screen, click on “Browse”, locate the VHD connected to this VM and click on “Open” Click “Finish” Now, when you try to power-on this virtual machine, you will see a nice error message like below Now, let us try one more experiment. Let us remove the previously attached differencing VHD from the …

Bing developer APIs – A VBScript demonstration

Bing – the most talked about and the most innovative decision engine. There is lot of talk on the Internet about this already. I am not going to write a review on that here. I want to show how developers can use — using a simple VBScript — the power of Bing in their applications. Bing API offers open, flexible options for building or enhancing your site or applications. Developing an application with the new API is straightforward: Choose a SourceType (or SourceTypes—Search, Spell, Translation, etc), choose an output protocol (JSON, SOAP, or XML) and then customize according to your needs. Before getting started with BING APIs, you need to get a APPID from Bing. For more information on how to create a appid, refer to http://www.bing.com/developers. You will have to login using your live ID and create an APPID for the application you are creating. There is a nice API basics guide to get you started. Now, to the more interesting stuff..! [Code][/Code] First example: Spell check [Code lang=”vb”] Set http = CreateObject(“Microsoft.XmlHttp”) strURL = “http://api.search.live.net/xml.aspx?AppId=Your_APPID&Query=coffee&Sources=Spell” …