Hi, I have just spent some time trying to adapt my VBA (which contains some WScript) to create a shortcut to a webserver but which runs IE as a different user. Due to how problematic this was for me I thought I might post it here - although was unsure what title to give the post!

The reason I needed to do this was we are undergoing a current domain migration, and in the interim period while all users on site are being migrated (about a month) the access to a web server must remain on the old domain.

This can be got around by doing runas /user:OLD_DOMAINUser "C:Program FilesInternet Exploreriexplore.exe http://server/site" in the run dialog box, and logging on in the cmd screen.

My issue was we have about 150 users who are not so PC friendly. I have a database of their account names, so thought I could you a bit of VB/WScript to create these Internet Shortcuts. Creating them all manually and putting them on their desktops was not what i really wanted to do [img]/forums/images/smilies/wink.gif[/img]

I turns out that the following code does the job. You have to make the shortcut a shortcut to the runas.exe, and add the rest of the command as an argument - trial and error eventually paid off <img src=/S/smile.gif border=0 alt=smile width=15 height=15> I did it in Excel, which is where I had my 150 usernames...

<pre>Sub CreateShortcuts()
Dim c As Range
For Each c In Range("SAM") 'this is a list of all the Account names in my spreadsheet
createSC c.Value
Next c
End Sub

Sub createSC(s As String)
Dim WshShell As Object
Dim FileShortcut As Object
Set WshShell = CreateObject("WScript.Shell")
Set FileShortcut = WshShell.CreateShortcut("M:Migrate" & s & ".lnk") ' set path for shortcuts to be saved to
FileShortcut.TargetPath = "C:WINDOWSsystem32runas.exe" 'shortcut to the runas.exe
' now add the arguments including AccountName and InternetExplorer.exe and web address URL
FileShortcut.Arguments = "/user:<[list=1]>" & s & " " & Chr(34) & _
"C:Program FilesInternet Exploreriexplore.exe http://<<server>>/<<site>>" & Chr(34)
FileShortcut.IconLocation = "%SystemRoot%system32SHELL32.dll,220" 'give it a nice IE icon
FileShortcut.WorkingDirectory = "Crogram filesinternet explorer"
End Sub

I'm glad it works, and thought to post just incase anyone else might need something similar