Public/Get-ADPLogin.ps1
function Get-ADPLogin { <# .SYNOPSIS Get a user's Login from ADP .DESCRIPTION Get a user's Login from ADP .PARAMETER ADPObject Object which holds the Login .EXAMPLE Input Object: ADP Object Return String: <Login> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $localLogin = $null switch ($ADPObject.workerID.idValue) { "L91Q489KS" { $localLogin = "daryoush"; break } "P7UYEW9JQ" { $localLogin = "deidre"; break } "ZCD3V5Q4H" { $localLogin = "sameera"; break } "A20I1ANCI" { $localLogin = "bhavin"; break } "4R3P1JQ32" { $localLogin = "gaurav"; break } "BW1UT7D8X" { $localLogin = "leila"; break } "UAFH7TURT" { $localLogin = "susie"; break } "6HFZ9BX3D" { $localLogin = "stephanieg"; break } "S8509Z5OV" { $localLogin = "rociocalero"; break } "9566ZCAAI" { $localLogin = "saura.naim"; break } "PIL0AHZT5" { $localLogin = "doug.stein"; break } "UEWZLSPXV" { $localLogin = "jim.rs"; break } "DH2W18SD2" { $localLogin = "matthew.bowen"; break } "I9BAAEZGY" { $localLogin = "liz.myrick"; break } "SCXJ9CXUW" { $localLogin = "puttappaiah.muniyappa"; break } "LWHRZ19J9" { $localLogin = "max.may"; break } "B8RVAOWQT" { $localLogin = "ramadevi.harikrishnan"; break } "VUXHVS3LW" { $localLogin = "raudel.garcia"; break } "F2FQFEJDZ" { $localLogin = "samantha.fane-hervey"; break } "7OKI3E190" { $localLogin = "lusana.ornelas"; break } "1ZUG8QWV1" { $localLogin = "krishna.bala"; break } "HM1" { $localLogin = "adithya"; break } "HM8" { $localLogin = "pandi"; break } "HM9" { $localLogin = "reddy"; break } "HM10" { $localLogin = "shivappa"; break } "HM15" { $localLogin = "vadivel"; break } "HM17" { $localLogin = "ankita"; break } "HM21" { $localLogin = "manjusha.annem"; break } "HM23" { $localLogin = "rimpul"; break } "HM24" { $localLogin = "vijeth"; break } Default { $firstName = ( $ADPObject | Get-ADPFirstName ) $lastName = ( $ADPObject | Get-ADPLastName ) $localLogin = "$firstName.$lastName" } } $localLogin = "$localLogin@workboard.com".ToLower().Replace(' ', '') return ( $localLogin | Get-ValidADPReturn ) } |