我可以直接在 Exchange 命令行管理程序中正确运行 Get-ActiveSyncDeviceAccessRule。(参考:http ://technet.microsoft.com/en-us/library/dd776124.aspx )
然后我写了一个批处理文件,如下所示,但我得到了CommandNotFoundException
. 我想知道如何将此 cmdlet 与 cmd.exe 一起使用?谁能帮助我?谢谢你。
(编者注:接下来的三行是为了格式化而换行的。原来是 1 行)
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Get-ActiveSyncDeviceAccessRule >C:\ActiveSyncDeviceAccessRule_output.txt
2>C:\standardError.txt
echo %errorlevel% >C:\exitCode.txt
我得到standardError.txt
如下错误:
The term 'Get-ActiveSyncDeviceAccessRule' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:31
+ Get-ActiveSyncDeviceAccessRule <<<<
+ CategoryInfo : ObjectNotFound: (Get-ActiveSyncDeviceAccessRule:
String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException