Multiple $arg

I’m trying to write a PS file that will up ADusers and their various fields, or leave them out if not needed. Relatively new to scripting so sorry about the brutal code. But am i on the right tracks?

So when i ps adupdate firstname.surname 12345 i am hoping that AD will update that account with the telephone number 12345. or update if department or organization is seleted.

---- Begin script ADUpdate.ps1 ----
$arg4 = "firstname.surname"
$arg5 = "officephone"
$arg6 = " Department"
$arg7 = "Organization"

$allArgs = @($arg4, $arg5, $arg6, $arg6)


Get-ADUser -Identity "$Arg4" | Set-ADUser -Officephone "$Arg5", 
if "$arg5" = null then,

	Get-ADUser -Identity "$Arg4" | Set-ADUser -Department "$Arg6",
		if "$arg6" = null then,

	Get-ADUser -Identity "$Arg4" | Set-ADUser -Organization "$Arg7",

)
----  End script ADUpdate.ps1  ----

Not sure the right track, no. I’d declare a Param() block and lay out your parameters, optional and mandatory. It’s much more in keeping with native patterns. “Learn PowerShell Scripting in a Month of Lunches” covers this in detail if you have access to a copy, but happy to try and answer questions here too.