VBscript FileSystemObject copy file gives permission denied error

This is something I forget about since I don't do a lot of file copying using VBS but I figured it is good information to have out there.

Any time you are copying to a folder using VBScript your folder path needs to have the trailing \ on it or your script will try to treat your folder like a file and try to overwrite it and give a permission denied.

So while this example will not work:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("c:\test.txt")
objFile.Copy "c:\temp", True

This one will:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("c:\test.txt")
objFile.Copy "c:\temp\", True

Windows 7 gadgets show a white box with greater than sign

Recently had a Windows 7 user who had some desktop gadgets from MSDN that were showing up as a small white box with a greater than sign in it while other gadgets were showing up fine. The fix was surprisingly simple.

Go into the control panel, choose default programs, set program access and computer defaults, select the Microsoft Windows option and click ok. Close down the sidebar process and restart it.  Gadgets should show up normal again.

You can reset your default programs back after this.

Setup was unable to create a new system partition or locate an existing system partition

As part of trying to recover data from a Novell NSS partition we attempted to install Windows 7 onto a brand new disk so we could run some recovery tools. During the install at the disk selection part we got the error in the title of this post. It took me awhile to figure it out but the resolution ended up being very simple. We had 2 raid controllers plugged in that once we unplugged the system was able to create the partition. It was a bit odd since the install did not even see these disks but it worked.

Recovering data from a corrupted VMWare guest


Recently I had a client whose previous support team had set them up with 2 servers running VMWare with one of them being duplicated to the other using Veeam. The one thing they failed to do was limit the growth of the VM partition to the available space of the drive so guess what happened? Yep the VM storage drive ran out of space and corrupted the heck out of the 2 disks attached to the only guest on it. Veeam then dutifully copied over the corrupted data. Once they called us the machine was beyond recovery as a usable machine (did I mention this was their DC?) even after trying several snapshots. We freed up enough space to boot the guest and got a solid 45 minutes of check disk repair and then a notice that were was no available AD information and a notice we needed to boot into recovery mode and restore that data. Too bad that was gone. So now the client really just wants their data back and a new machine built but how were we going to get into the drive hosted on a Unix machine with multiple snapshots?  It turns out this ended up being easier than expected.  There is a great bootable CD called SystemRescueCD which I was able to upload to the storage partition on VMWare and attach it as a CD image to the corrupted guest and boot from. Once booted you can attach the drives using the mount command and the drive name in our case it was sdb1 so:

mount -t ntfs /dev/sdb1 /mnt/windows -o ro

Once the drive is mounted you can copy the data off over the network just like normal assuming the rescue cd was able to initialize your network card. I would recommend the use of a program like teracopy to do the copy rather than normal windows copy. Keep in mind this mounts the drive read only so any tools like teracopy need to be installed on the destination machine. You can mount the drive read/write but this is not recommended.

iTunes artwork not modifiable

So I had a user ask me the other day why in iTunes he can't change any of his artwork on his TV shows he put on his iPad. Odd question but since I have an iPad I was curious as well. I did some looking online and saw some other people asking the same question but no answers or answers like "you don't have enough rights to the file to edit it." None of the sparse answers I found were right but after some questioning I did find out that he had recently enabled the sync TV shows option under the main iPad settings/TV Shows section and then later disabled. The odd thing was every time he went and sync'd TV shows manually again it would put that check back in sync TV shows. It turned out once we put a check in "manually manage my music and videos" in the main section it stopped doing this and it enabled him to modify the artwork again.

Quickly update self signed Exchange certificates

We have several customers who use self signed certificates for their Exchange SBS servers and I wanted to share a quick easy way to update expired certificates.

First you can get a list of all certificates using Get-ExchangeCertificate

Then when you have the certificate you need to replace copy the thumbprint and issue the following command.

Get-ExchangeCertificate -Thumbprint <the thumbprint> | New-ExchangeCertificate

Once you are sure it is installed and working you can remove the old expired cert with

Remove-ExchangeCertificate -Thumbprint <the thumbprint>

This process makes it a bit easier since it retains all the information you need that already existed in the old cert.

Get details about user mailboxes on Exchange 2010

Ever wanted to see how much email all of your users have or how much space their deleted items is taking up? This PowerShell command will give you some nice details on all of your mailboxes on an Exchange Server. Replace exchange with your server name.

Get-MailboxStatistics -server exchange | where {$_.ObjectClass -eq "Mailbox"} | Sort-Object TotalItemSize -Descending | ft @{label="User";expression={$_.DisplayName}},@{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},@{label="Items";expression={$_.ItemCount}},@{label="DeletedItems";expression={$_.deletedItemCount}},@{label="DeletedItemSize (KB)";expression={$_.totalDeletedItemSize.value.toKB()}},@{label="Storage Limit";expression={$_.StorageLimitStatus}} -auto

You will get a report like this

 User                         Total Size (MB)  Items DeletedItems DeletedItemSize (KB) Storage Limit
----                              ---------------             -----      ------------   --------------------     -------------
User1                          10466                  96237          490                 2888           NoChecking
User2                            6021                  71813          248                 5219           NoChecking
User3                            4033                  46138          809                 7921           NoChecking
User4                            3843                  37157          945                 4141           NoChecking