This topic contains 2 replies, has 2 voices, and was last updated by
April 9, 2015 at 8:44 am #24105ParticipantPoints: 0Rank: Member
I am new to PowerShell. I started learning it a few days ago.
I know my question my be dumb, I was wondering if any of you can help me.
I was using Exchange Management Shell and I trying to change a PramaterType called UseDatabaseQutaDefaults as $True for a user.
I had assigned the user's mailbox to a variable $s. The reason was b/c I want to be able to assigned multiple names or use the Get-Content in the future if I have a bulk of users.
$s = Set-Mailbox Test.User
Commands that I tried changing the UseDatabaseQuotaDefaults
$s UseDatabaseQuotaDefaults $True
$s -UseDatabaseQuotaDefaults $True
I'm getting the following error
Missing expression after unary operator '-'.
At line:1 char:7
+ $s | – <<<< UseDatabaseQuotaDefaults $true + CategoryInfo : ParserError: (-:String) , ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingExpressionAfterOperator I was wondering if someone can explain to me why this doesn"t work. I"m exploring PowerShell right now to see what other ways I can do it. I know it works if i do "Set-Mailbox Test.User -UseDatabaseQuotaDefaults $True
April 9, 2015 at 8:59 am #24106KeymasterPoints: 1,811Rank: Community Hero
$s contains whatever is output from Set-Mailbox. I'm not sure that Set-Mailbox actually outputs anything, so $s may be null.
Set-Mailbox -Identity TestUser -UseDatabaseQuotaDefaults $true
Would run the command, changing the user's quota to use the database quota defaults. This change is done by running the command, and providing parameters to the command.
April 9, 2015 at 9:13 am #24107ParticipantPoints: 0Rank: Member
Thank You Don.
That make sense that $s maybe null. I'll explorer around a little bit more on how it works.
Since, I started learning PowerShell. I always thought that when assigning a Variable to whatever contents are stored in that Variable. I could always call the Variable to do certain Commands/Changes.
I guess I should read more about assigning a variable to Get-Content or using Script Block.
The topic ‘Value Expression Operator '-'’ is closed to new replies.