This commit is contained in:
2023-01-03 16:03:15 +01:00
parent 75df258abf
commit b33720c61e
56 changed files with 132 additions and 106 deletions

View File

@@ -476,32 +476,31 @@ Public Class Windream
' If username, password and domain are set, login with impersonation
' Else, login with current credentials
oImpersonation = False
If UserName IsNot Nothing And Password IsNot Nothing And Domain IsNot Nothing Then
oImpersonation = True
oCredentials = New WMUserIdentity() With {
.aServerName = ServerName,
.aUserName = UserName,
.aPassword = Password,
.aDomain = Domain
}
If UserName <> String.Empty And Password <> String.Empty And Domain <> String.Empty Then
oImpersonation = True
_logger.Info("Impersonated Login: {0}", oImpersonation)
_logger.Info("Username: {0}", IIf(UserName IsNot Nothing, UserName, Environment.UserName))
_logger.Info("Domain: {0}", IIf(Domain IsNot Nothing, Domain, Environment.UserDomainName))
oCredentials = New WMUserIdentity() With {
.aServerName = ServerName,
.aUserName = UserName,
.aPassword = Password,
.aDomain = Domain
}
oConnect.ModuleId = 9
Else
oImpersonation = False
oConnect.ModuleId = 9
End If
End If
If oImpersonation = False Then
oCredentials = New WMUserIdentity() With {
.aServerName = ServerName
}
End If
If UserName IsNot Nothing Then
If UserName <> String.Empty Then
_logger.Info("Impersonated Login: {0}", oImpersonation)
_logger.Info("Username: {0}", IIf(UserName IsNot Nothing, UserName, Environment.UserName))
_logger.Info("Domain: {0}", IIf(Domain IsNot Nothing, Domain, Environment.UserDomainName))
End If
End If
Try
_logger.Debug("Trying to create a session...")
oSession = oConnect.Login(oCredentials)
_logger.Info("Connected..Session created")
Catch ex As Exception