Chilkat, Telefone, Zoll Notruf
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
Imports System.IO
|
||||
Imports System.Management.Automation
|
||||
Imports System.Management.Automation.Runspaces
|
||||
Imports System.Security
|
||||
|
||||
Public Class cExtProgramme
|
||||
|
||||
@@ -14,10 +17,9 @@ Public Class cExtProgramme
|
||||
edge.StartInfo.Arguments = " " & URL
|
||||
edge.Start()
|
||||
End If
|
||||
|
||||
ElseIf URL = "" Then
|
||||
Exit Function
|
||||
Else
|
||||
Exit Function
|
||||
Else
|
||||
Dim mstsc As New Process
|
||||
mstsc.StartInfo.FileName = "mstsc.exe"
|
||||
mstsc.StartInfo.Arguments = " /v: " & URL
|
||||
@@ -72,6 +74,38 @@ Public Class cExtProgramme
|
||||
ping.Start()
|
||||
End Function
|
||||
|
||||
Public Shared Function RunRemotePSScript(ByVal connectTo As String, ByVal user As String, ByVal password As String, ByVal script As String, Optional ByVal ps1 As Boolean = False) As System.Collections.ObjectModel.Collection(Of PSObject)
|
||||
Const SHELL_URI As String = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell"
|
||||
Dim serverUri As New Uri("http://" & connectTo & ":5985/wsman")
|
||||
|
||||
Dim securepass As New SecureString
|
||||
Dim c As Char
|
||||
For Each c In password
|
||||
securepass.AppendChar(c)
|
||||
Next
|
||||
Dim remotecred As New PSCredential(user, securepass)
|
||||
|
||||
Dim connectionInfo As New WSManConnectionInfo(serverUri, SHELL_URI, remotecred)
|
||||
Dim myRunSpace As Runspace = RunspaceFactory.CreateRunspace(connectionInfo)
|
||||
Dim psresult As New System.Collections.ObjectModel.Collection(Of PSObject)
|
||||
myRunSpace.Open()
|
||||
|
||||
Dim psh As PowerShell = PowerShell.Create()
|
||||
psh.Runspace = myRunSpace
|
||||
|
||||
If ps1 = False Then
|
||||
psh.AddScript(script)
|
||||
Else
|
||||
psh.AddCommand(script)
|
||||
End If
|
||||
|
||||
psh.Invoke(Nothing, psresult)
|
||||
Return psresult
|
||||
|
||||
psh.Dispose()
|
||||
myRunSpace.Close()
|
||||
End Function
|
||||
|
||||
Public Shared Function msgsend(argumente As String, Optional ByVal ReturnOrder As Boolean = False)
|
||||
Try
|
||||
Dim msg As New Process
|
||||
@@ -109,14 +143,15 @@ Public Class cExtProgramme
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function RDPConnect(host As String, Optional ByVal Username As String = "", Optional ByVal Password As String = "", Optional ByVal Fenster As Boolean = False)
|
||||
Public Shared Function RDPConnect(host As String, Optional ByVal Username As String = "", Optional ByVal Password As String = "", Optional ByVal Fenster As Boolean = False, Optional ByVal admin As Boolean = False)
|
||||
Dim mstsc As New Process
|
||||
Dim AnmeldeDatenVorhanden As Boolean = False
|
||||
Dim rdpASadmin As String = ""
|
||||
If admin Then rdpASadmin = " /admin"
|
||||
Dim FensterString As String = ""
|
||||
|
||||
If Fenster = True Then
|
||||
FensterString = " /w:1280 /h:1024"
|
||||
FensterString = " /w:1920 /h:1080"
|
||||
Else
|
||||
FensterString = " /f"
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user