I am trying to write a script... When a User(logging in from his Domain account) runs this script on the console and gives his username, the result would be a customized message for him. That task is fairly simple. But, I DONT want him to have a sneak peek at others' message. And hence I want to limit his scope to his username only. I was thinking something like "If the username is equal to the username with which the user has logged in, then execute the script." Is this logic "scriptable"? If yea, how may i do it? If no, please provide alternatives.
Current script is something like below.
##########################
param([string]$username)
if ($username -eq 'h.lecter')
{Write-Host "hello"}
elseif ($username -eq 'v.andolini')
{write-host "$username Hi"}
else {write-host "$username not found"}
#########################
Thanks
Ravi