PureGremlin

SSO Object GUID ID

Dec 6th, 2022 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Convert-GUIDtoBase64{ param ($guid); [system.convert]::ToBase64String(([GUID]$guid).ToByteArray())}
  2.  
  3. Function newForm([string] $title, [string] $message, [string] $defaultText)
  4. {
  5.  
  6. Add-Type -AssemblyName System.Windows.Forms
  7. Add-Type -AssemblyName System.Drawing
  8.  
  9. $reply = New-Object System.Windows.Forms.Form
  10. $reply.Text = $title
  11. $reply.Size = New-Object System.Drawing.Size(300,200)
  12. $reply.StartPosition = 'CenterScreen'
  13.  
  14. $okButton = New-Object System.Windows.Forms.Button
  15. $okButton.Location = New-Object System.Drawing.Point(75,120)
  16. $okButton.Size = New-Object System.Drawing.Size(75,23)
  17. $okButton.Text = 'OK'
  18. $okButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
  19. $reply.AcceptButton = $okButton
  20. $reply.Controls.Add($okButton)
  21.  
  22. $cancelButton = New-Object System.Windows.Forms.Button
  23. $cancelButton.Location = New-Object System.Drawing.Point(150,120)
  24. $cancelButton.Size = New-Object System.Drawing.Size(75,23)
  25. $cancelButton.Text = 'Cancel'
  26. $cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
  27. $reply.CancelButton = $cancelButton
  28. $reply.Controls.Add($cancelButton)
  29.  
  30. $label = New-Object System.Windows.Forms.Label
  31. $label.Location = New-Object System.Drawing.Point(10,20)
  32. $label.Size = New-Object System.Drawing.Size(280,20)
  33. $label.Text = $message
  34. $reply.Controls.Add($label)
  35.  
  36. $textBox = New-Object System.Windows.Forms.TextBox
  37. $textBox.Location = New-Object System.Drawing.Point(10,40)
  38. $textBox.Size = New-Object System.Drawing.Size(260,20)
  39. $textBox.Text = $defaultText
  40. $reply.Controls.Add($textBox)
  41.  
  42. $reply.Topmost = $true
  43.  
  44. $reply.Add_Shown({$textBox.Select()})
  45. $result = @{ Status=$reply.ShowDialog();Data=$textbox.text}
  46. $result
  47. }
  48. $result = newForm "SSO lookup" "username here" "first.last"
  49. if ($result['Status'] -eq [System.Windows.Forms.DialogResult]::OK)
  50. {
  51.     $x = $result['Data']
  52.  
  53.     Convert-GUIDtoBase64 (get-aduser $x).objectguid| tee -variable identifier | clip
  54.     newForm "SSO Identifier result" "The identifier has been copied to the clipboard" $identifier
  55. }
  56.  
Add Comment
Please, Sign In to add comment