25-08-22 04:22 PM
I was reviewing the BluePrism object that is supposed to unlock a VW AD session. However, the unlock just executes the same page as the login code which includes LOGON and writing domain/username, which isn't necessary, so it's failing. I think I need to update the code to use the existing Pipe Client (whatever that is) instead of creating a new one, and then change the WriteString command to only send the password. Can someone provide the correct code or point me in the right direction?
Current "Authenticate To Windows" code:
Try
'Create a new pipe client
Using pipeClient As New NamedPipeClientStream(
".",
"BluePrismCredentialProviderPipe",
PipeDirection.InOut,
PipeOptions.None,
TokenImpersonationLevel.Impersonation)
'Attempt to connect to it
pipeClient.Connect(10000)
'Send credentials
Dim dom As String
If Local Then
dom = Environment.MachineName
Else If Domain = "" Then
dom = Environment.UserDomainName
Else
dom = Domain
End If
Dim ss As New StreamString(pipeClient)
ss.WriteString(String.Format("LOGON{0}{1}{0}{2}{0}{3}", vbLf, dom, Username, Password))
'Wait for reply
Using pr As New StreamReader(pipeClient, Encoding.Unicode)
Response = pr.ReadLine()
If Response = "OK" OrElse Response = "UNKNOWN" Then Return
ErrorCode = pr.ReadLine()
ErrorMessage = pr.ReadLine()
End Using
End Using
Catch ex As Exception
Response = "ERROR"
ErrorCode = ""
ErrorMessage = ex.Message
End Try
08-09-22 07:01 PM