'******************************************************* Set WshShell = WScript.CreateObject("WScript.Shell") Set WshProcEnv = WshShell.Environment("Process") strSessionName = WshProcEnv("SESSIONNAME") If Left(strSessionName, 3) = "RDP" then WScript.Echo "Session RDP = " & strSessionName Else WScript.Echo "Session pas RDP" End If '*******************************************************
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" ( _ ByVal lpBuffer As String, nSize As Long) As Long
Private Function GetMyMachineName() As String Dim r As Long Dim sTemp As String ' Buffer r = MAX_COMPUTERNAME_LENGTH sTemp = String(r + 1, " ") ' Nom de la machine Call GetComputerName (sTemp, r) ' Supprime les espaces en trop et renvoie le résultat GetMyMachineName = Left$(sTemp, r) End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question