1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| AdrIp= InputBox( "Insérez ici votre code IP" , "IP" , "la valeur par défaut" )
' cree le fichier rdp pour preparer la connection
Const ForReading = 1, ForWriting = 2
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\ecr.rdp", ForWriting,true)
f.write("screen mode id:i:2") & vbCrlf
f.write("desktopwidth:i:1440") & vbCrlf
f.write("desktopheight:i:900") & vbCrlf
f.write("session bpp:i:32") & vbCrlf
f.write("winposstr:s:0,3,0,0,800,600") & vbCrlf
f.write("compression:i:1") & vbCrlf
f.write("keyboardhook:i:2") & vbCrlf
f.write("displayconnectionbar:i:1") & vbCrlf
f.write("disable wallpaper:i:1") & vbCrlf
f.write("disable full window drag:i:1") & vbCrlf
f.write("allow desktop composition:i:0") & vbCrlf
f.write("allow font smoothing:i:0") & vbCrlf
f.write("disable menu anims:i:1") & vbCrlf
f.write("disable themes:i:0") & vbCrlf
f.write("disable cursor setting:i:0") & vbCrlf
f.write("bitmapcachepersistenable:i:1") & vbCrlf
f.write("full address:s:")&AdrIp & vbCrlf
f.write("audiomode:i:0") & vbCrlf
f.write("redirectprinters:i:1") & vbCrlf
f.write("redirectcomports:i:0") & vbCrlf
f.write("redirectsmartcards:i:1") & vbCrlf
f.write("redirectclipboard:i:1") & vbCrlf
f.write("redirectposdevices:i:0") & vbCrlf
f.write("autoreconnection enabled:i:1") & vbCrlf
f.write("authentication level:i:0") & vbCrlf
f.write("prompt for credentials:i:0") & vbCrlf
f.write("negotiate security layer:i:1") & vbCrlf
f.write("remoteapplicationmode:i:0") & vbCrlf
f.write("alternate shell:s:") & vbCrlf
f.write("shell working directory:s:") & vbCrlf
f.write("gatewayhostname:s:") & vbCrlf
f.write("gatewayusagemethod:i:4") & vbCrlf
f.write("gatewaycredentialssource:i:4") & vbCrlf
f.write("gatewayprofileusagemethod:i:0") & vbCrlf
f.write("promptcredentialonce:i:1") & vbCrlf
f.write("domain:s:'Nom du domaine de connection'") & vbCrlf
f.write("username:s:")& 'Nom Utilisateur' & vbCrlf
' ouvre mstsc avec les bonnes coordonnees
Dim Shell
Set shell = CreateObject("WScript.Shell")
call shell.run("""mstsc""" & """c:\ecr.rdp""") |
Partager