locked
convert to PowerShell RRS feed

  • Question

  • Is it possible to convert this VBS script to PowerShell ?

    Option explicit
    On Error resume next

    dim oneSignAuth
    set oneSignAuth = WScript.CreateObject("OneSignAuth.OneSignAuth")

    if IsNull(oneSignAuth) Then
        MsgBox "Error. cannot create OneSignAuth object"
        WScript.Quit(1)
    End If

    if IsNull(oneSignAuth.CurrentOneSignUser) Then
        MsgBox "There is no logged in OneSign user"
        WScript.Quit(1)    
    End If  

    dim currentOneSignUser
    set currentOneSignUser = oneSignAuth.CurrentOneSignUser

    MsgBox "current OneSign user is '" + currentOneSignUser.Username + "'"


    mqh7

    Wednesday, April 26, 2017 5:23 PM

Answers

  • $oneSignAuth = New-Object -Com "OneSignAuth.OneSignAuth"
    $currentOneSignUser = $oneSignAuth.CurrentOneSignUser


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    • Marked as answer by mqh7 Wednesday, April 26, 2017 8:54 PM
    Wednesday, April 26, 2017 8:45 PM

All replies

  • Of course that's possible when you know both languages. ;-)  Most of the time it is more purposeful to write the scripts freshly in Powershell than to translate them from VBScript.


    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Wednesday, April 26, 2017 8:14 PM
  • I know PowerShell a little but.  all I really need to know what is what is PowerShell equivalent of:

    set oneSignAuth = WScript.CreateObject("OneSignAuth.OneSignAuth")

    set currentOneSignUser = oneSignAuth.CurrentOneSignUser

    if I can get that data I'm good.  


    mqh7

    Wednesday, April 26, 2017 8:31 PM
  • That's what I meant. Really often there is no exact equivalent. I don't know VBScript. What does this code mean or what this code do?

    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Wednesday, April 26, 2017 8:35 PM
  • We use a single sign on product called Imprivata.  It allows you to "tap in" to a PC and it will auto log you in and proxy your credentials for certain apps.   We have many Windows 7 workstations that auto login as a generic user.  Then, you can "tap in" and you are now the tapped in Imprivata user.......but our generic domain account is still logged into the Windows OS.   This VB script tells me who is the tapped in Imprivata user.

    I have not been able to see who is the tapped in user by using Get-WMIObject.   so I wanted to know what VB was actually doing and then I can do the same in PowerShell.


    mqh7

    Wednesday, April 26, 2017 8:40 PM
  • $oneSignAuth = New-Object -Com "OneSignAuth.OneSignAuth"
    $currentOneSignUser = $oneSignAuth.CurrentOneSignUser


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    • Marked as answer by mqh7 Wednesday, April 26, 2017 8:54 PM
    Wednesday, April 26, 2017 8:45 PM
  • $oneSignAuth = New-Object -Com "OneSignAuth.OneSignAuth"
    $currentOneSignUser = $oneSignAuth.CurrentOneSignUser
    $currentOneSignUser.Username

    THATS IT!!  Thanks.  


    mqh7

    Wednesday, April 26, 2017 8:54 PM