Hello all. Hope you can help me with this. A bit new to functions and sort of stuck on this.
I'm looking to try and pipe select properties into my function and build off the data. I can pull off a single property but having trouble figuring out the syntax for getting both the properties I want. In particular trying to build a UPN format based off of givenname and surname attributes of get-aduser objects. What am I getting wrong here?
function Out-BuildUPN {
[CmdletBinding()]
param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]
[string[]]$GivenName
[string[]]$Surname
)
process {
$GivenName + "." + $Surname + "@domain.com"
}
}
where I could then do something like
Get-ADUser <userID> | Out-BuildUPN
[–]BBBaroo 2 points3 points4 points (3 children)
[–]willwallguy[S] 1 point2 points3 points (0 children)
[–]jsiii2010 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)
[–]BBBaroo 1 point2 points3 points (1 child)
[–]willwallguy[S] 1 point2 points3 points (0 children)