【发布时间】:2017-09-01 08:15:54
【问题描述】:
PSCommand commandToRun = new PSCommand();
commandToRun.AddCommand("Connect-MsolService");
commandToRun.AddParameter("Credential", new PSCredential(msolUsername, msolPassword));
powershell.Streams.ClearStreams();
powershell.Commands = commandToRun;
powershell.Invoke();
我试图在 Visual Studio 中运行上述代码并收到以下错误: “Connect-MsolService”一词未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。 但我能够从 Microsoft Azure Active Directory Module for Windows PowerShell 连接到 Msol 服务。请帮忙。
【问题讨论】:
-
尝试使用
Import-Module MSOnline导入模块
标签: powershell azure office365