/ / Powershell- NewAcceptedDomain Command ne fonctionne pas dans Visual Studio. Mais ça marche très bien dans PowerShell - PowerShell

Powershell- NewAcceptedDomain Command ne fonctionne pas dans Visual Studio. Mais ça marche très bien dans PowerShell - PowerShell

J'essaie d'exécuter cette commande Powershell à partir de Visual Studio. Ma commande est

add-pssnapin microsoft.exchange.management.powershell.snapin; New-accepteddomain –name domain123.com –domainname domain123.com

Cela me donne toujours une erreur. L'erreur est:

"The term "New-AcceptedDomain" 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."

Mais quand j'ai essayé cette commande dans Powershell, cela fonctionne bien. Mais chaque fois que j’essayais d’exécuter cette commande à partir de mon code, cela me donnait l’erreur mentionnée ci-dessus.

Réponses:

0 pour la réponse № 1

IIRC le composant logiciel enfichable Exchange est 64 bits donc iln'est pas disponible pour le moteur PowerShell 32 bits hébergé dans le processus devenv.exe (Visual Studio) 32 bits. Depuis la console Nuget Package Manager, exécutez:

Get-PSSnapin -Registered

Pour voir si le composant logiciel enfichable Exchange s'affiche.