Forum Discussion
Update-MgUser : Cannot convert the literal '0' to the expected type 'Edm.String'.
JonathanDatois correct, and you can see this in action if you run the comandlet using the -Debug parameter.
Example 1
Commandlet being run
Update-MgBetaUser -UserId "3e8a5b03-507b-4bd6-98be-69fae0efcaf2" -CompanyName "00000" -Debug;
Debug output
Example 2
Commandlet being run
You don't have to use constructs like "$()". Just use opposing quotes to enclose the string value versus those inside of the string.
You can see I've used single quotes to enclose the string while using double quotes inside the string, where because the single quote is the first quote PowerShell sees, it considers it to be the delimiter.
Note: You could just as easily reverse the quotes and use "'00000'" but for reasons I wont bore you with, I've quite deliberately chosen single quotes to enclose the string in for this static value.
Update-MgBetaUser -UserId "3e8a5b03-507b-4bd6-98be-69fae0efcaf2" -CompanyName '"00000"' -Debug;
Debug output
Sadly, not all commandlets produce useful output when -Debug is specified, but fortunately the Microsoft Graph commandlets do, which is great when diagnosing issues with type conversion in the body.
Cheers,
Lain