Search code examples
windows-explorerudl

RUN UDL file as different user


I sometimes create and run a Universal Data Link file (UDL) to check a machine will connect to a database on a target\remote machine and this works well as my own network account. However, is it possible to run a UDL file as a different user - WITHOUT having to login to client machine as that user? I know most apps I can simply hold down RIGHT SHIFT key and RIGHT CLICK the app and I have options for running as Administrator or different user, or most windows apps can be configured to run this way, but I cannot find how to configure a UDL file to run for example as a local server account on the target server, or a different network account valid to myself WITHOUT having to login to client machine as that user.

Can this be done please?

I have tried the "runas" component but it states the UDL is not a win32 app. I tried adding a registry entry of "ShowRunasDifferentuserinStart" to registry path "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer" but found there was no Explorer in "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows"


Solution

  • One way I found to achieve this is to start a new CMD window using the account you wish to use for the UDL, then use start to launch the UDL file.

    runas /user:DOMAIN\account "cmd"
    

    This opens a new CMD window using the credentials supplied. In the new CMD window, you can then open the UDL file by entering start C:\path\to\my.udl