title: How to run an elevated command as impersonated user within a domain
body: <p>We have a lot of clients within our domain that are not constant connected with our network. Our users are working on small (sometimes disconnected) local networks with different types of network printers (usually provided by us). Within this small network there are also people NOT enlisted in our domain (partners, employers,..) that need these printers. Some of these users are local administrators but most are not.</p>
  
  <p>My goal is to (dynamically) create an installer for each printer so the user may run this installer either from our network, usb, cd,.. so the local tcp/ip port is created, the printerdriver gets installed and the printer gets added.</p>
  
  <p>My problem lies in obtaining sufficient rights to perform the installation.
  (1) IF (and only IF!) the local user is an administrator, the installer should launch an elevated app to handel the installation.
  (2) IF the user is a member of our domain but he is NOT a local administrator, the installer should use a local administrator account that was added by our policies.</p>
  
  <p>I know how to run an elevated process which brings up the UAC for confirmation and i know how to impersonate another user..</p>
  
  <p>But when trying to Elevate a command while impersonating i never get to see an elevation confirmation.. Which is logical and normal.</p>
  
  <p>Any tips or tricks? Anyone?</p>