functions/Get-UserID.ps1
<#
.SYNOPSIS Returns User ID for given user name. .DESCRIPTION Returns User ID for given user name. .EXAMPLE Get-UserID "admin" Output 1 #> Function Get-UserID { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string]$UserName ) $userList = Get-AllUsers $userList | ForEach-Object { If($_.name -eq $UserName){ Return $_.id } } } |