我想为律师的名字使用一个变量,以便可以回收相同的Get-MailboxFolderPermission命令,但语法似乎不起作用。
命令本身是: Get-MailboxFolderPermission jdoe:\ calendar
但是,如果我尝试将“ jdoe”放入变量中($ lawyer =“ jdoe”) 然后尝试在命令中调用它 Get-MailboxFolderPermission $ lawyer:\ calendar 它给出一个错误: 变量引用无效。 ':'后面没有有效的变量名字符。考虑使用$ {} 分隔名称。 + CategoryInfo:ParserError:(:) [],ParentContainsErrorRecordException + FullyQualifiedErrorId:InvalidVariableReferenceWithDrive
Get-MailboxFolderPermission“ $($ jdoe):\ calendar”不会给出错误,但也不会产生其日历权限的准确输出。
我怀疑它与命令中的“:”有关,但是我找不到解决此特定问题的文章。
答案 0 :(得分:0)
对不起,我只是根据错误弄清楚了。 Get-CalendarPermission $ {jdoe}:\ calendar正常工作。