64 bit PrimalScript 2019
64 bit OS: Win 10
Question - Why when building a script and testing does it tell me to connect to msolservice? Example below
Code: Select all
$username=Read-Host "Email Address"
$role=Read-Host "Role to Add"
Add-MsolRoleMember -RoleName $role -RoleMemberEmailAddress $username
When I run the script (ctrl+f5) it pops up diag box, for the username to add and the role to add. Great that part works
Now when I check to confirm user added, user not there.
Looking at the output diag box i see:
"ERROR: Add-MsolRoleMember : The term 'Add-MsolRoleMember' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
ERROR: of the name, or if a path was included, verify that the path is correct and try again
I have tried a few other things thinking I lost connection some how, but I didn't I can still do other things with Msol.
Still same issue when trying to run it from looking at the script (kind of in edit mode)
From the File Browser if I right click on script and "run in shell" it works, no popups but in console able to enter name and role. Then when checking I see that the new user is added to that role.
Anything I am missing or not really doing correctly? I should not have to add the connect-msolservice to this script to run it every time.