close

이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

windows/exchange

EXCHANGE ) XXXX is not recognized as an internal or external command,operable program or batch file.

mysop 2022. 6. 2. 14:09
728x90
반응형
XXXX is not recognized as an internal or external command,
operable program or batch file.

원인 

실행 하려는 path 위치를 제대로 못찾아서 나타는 오류

 

해결방법

bat 파일내 파일이름 앞에 절대경로집어넣기

또는 윈도우 path환경설정에 해당 실행파일 위치 넣기

 

그런데...

 

Exchange 같은 powershell 프로그램이라면??

 

powershell -psconsolefile "C:\Program Files\Microsoft\Exchange Server\V15\Bin\exshell.psc1" -noexit "& 명령어

물론 위치는 exchange 버젼따라 조금 다를수 도 있지만

대략 exchange shell을 저렇게 실행해서

 

배치파일에서 자동 실행 가능하다

 

-noexit를 제거하면

명령 실행후 powershell은 자동종료

 

 

일이 간편해 진다.

 

출처 : https://serverfault.com/questions/799239/running-exchange-powershell-script-from-a-batch-file-command-doesnt-work-what

 

Running Exchange Powershell script from a batch file: command doesn't work. What's wrong with my syntax?

Coming from this question here: How to create a script for Exchange Powershell to modify settings for all shared mailboxes? Here is my Powershell script (scroll right to see all): $Mailboxes = Get-

serverfault.com

 

728x90
반응형