powershell - Argument errors with office 365 cmdlet -
i'm having issues feeding variables new-msoluser cmdlet. i'm getting next error.
new-msoluser : positional parameter cannot found accepts argument 'â?userprincipalname ausertest@test.ie â?usagelocation'. @ c:\users\test\documents\test.ps1:148 char:1 + new-msoluser -displayname $targetfullname â?"userprincipalname $targetemail â?" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidargument: (:) [new-msoluser], parentcontainserrorrecordexception + fullyqualifiederrorid : positionalparameternotfound,microsoft.online.administration.automation.newuser the code using is:
$source = "anotheraduser" $targetfname = "new" $targetlname = "user" $target = "ausertest" $targetfullname = [string]::concat($targetfname ," ", $targetlname) $sourceemail = (get-aduser $source -property emailaddress).emailaddress $sourcedomain = $sourceemail.split("@")[1] $targetemail = ([string]::concat($target , "@" , $sourcedomain)) new-msoluser -displayname $targetfullname –userprincipalname $targetemail –usagelocation "ie" | set-msoluserlicense -addlicenses "testinstall:exchangestandard" this command works when hardcode details..
–userprincipalname , –usagelocation utilize not minus character character code 8211. maybe it's fine seek utilize standard minus instead, sure.
powershell office365
No comments:
Post a Comment