Generally the admin$ share has to be specially activated in Vista (not Windows7 however). Even having done that (a registry hack), the code sample fails.
I have a set of install scripts that must be run in command shell on network-connected systems, because some of my clients still will not allow WSH or Powershell at their sites!! I need a way of deciding if the user doing the install has admin rights before starting it.
There are several MSI installs and some dll registration and file copying involved, so I cannot simply make it one MSI.
Looks like I will have to spend a lot more time and make it a full installer so that I can raise the privilege myself.