Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

TFS에 설치된 SharePoint 의 PowerShell 콘솔 띄우는 방법

SharePoint를 설치하면 전용 PowerShell 아이콘이 하나 생기고, 그 안에서 SharePoint 객체를 다룰 수 있는데요. TFS를 통해 SharePoint를 설치한 경우에는 그 아이콘이 없습니다. 그래서, 일반 PowerShell 콘솔을 띄우고 SP 개체를 접근하려면 오류가 발생합니다.

PS D:\bin> $h = Get-SPServiceHostconfig
Get-SPServiceHostconfig : The term 'Get-SPServiceHostconfig' 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:29
+ $h = Get-SPServiceHostconfig <<<<
    + CategoryInfo          : ObjectNotFound: (Get-SPServiceHostconfig:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

이런 경우, 수작업으로 PowerShell 용 SharePoint 어셈블리를 추가해 주면 됩니다. 그런데, 저는 다음과 같은 오류가 발생하는군요. ^^

PS C:\Windows\system32> Add-PSSnapin Microsoft.SharePoint.PowerShell
The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

이는 현재 PowerShell 콘솔을 실행한 윈도우의 사용자 계정이 SharePoint_Config 데이터베이스에 권한이 없기 때문입니다. 이와 관련해서는 다음의 글을 참고하셔서 SharePoint_Shell_Access 와 DB_Owner 권한을 추가해 주면 됩니다.

The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered 
; http://www.sharepointassist.com/2010/01/29/the-local-farm-is-not-accessible-cmdlets-with-featuredependencyid-are-not-registered/comment-page-1/

이젠 Add-PSSnapin 명령어 실행은 잘 되지만, 끝이 아니었습니다. ^^

PS C:\Windows\system32> $h = Get-SPServiceHostconfig
Get-SPServiceHostconfig : Microsoft SharePoint is not supported with version 4.0.30319.18010 of the Microsoft .Net Runtime.
At line:1 char:6
+ $h = Get-SPServiceHostconfig
+      ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...ServiceSettings:SPCmdletGetIisWebServiceSettings) [Get-SPServiceHostConfig], PlatformNotSupportedException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetIisWebServiceSettings

이 문제는 "Microsoft.SharePoint.PowerShell" 어셈블리는 .NET 2.0 용 어셈블리이고 .NET 2.0 기반에서만 정상동작하지만, 윈도우 서버 2012에 포함된 PowerShell 이 .NET 4.0 기반으로 실행되기 때문입니다.

해결책은 다음의 글에 나오는데요.

SharePoint 2010 Management Shell - .Net 4.0 runtime version error
; http://blogs.technet.com/b/mspfe/archive/2012/09/06/sharepoint-2010-management-shell-net-4-0-runtime-version-error.aspx

즉, PowerShell 콘솔을 .NET 2.0 기반으로 실행하라고 지정해 주면 되는 것입니다.

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Version 2 







[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 4/9/2013]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 121  122  [123]  124  125  126  127  128  129  130  131  132  133  134  135  ...
NoWriterDateCnt.TitleFile(s)
10848정성태9/8/201527337VS.NET IDE: 103. Visual Studio의 Ctrl + F5 실행 동작파일 다운로드1
10847정성태9/8/201523443VS.NET IDE: 102. 목록(List) 타입의 값을 디버깅 중 Watch 창에서 확인하는 방법 [1]파일 다운로드1
10846정성태9/8/201520812오류 유형: 306. "query user" 명령어에 공백 문자가 포함된 계정을 전달하는 경우
10845정성태9/3/201521893오류 유형: 305. 윈도우 백업 시 오류 - 0x80780166
10844정성태9/2/201523104.NET Framework: 528. C# - 상호 참조하는 경우의 정적 생성자 동작 방식 [4]파일 다운로드1
10843정성태9/1/201523814VS.NET IDE: 101. Visual Studio 2015의 솔루션 탐색기가 클래스 뷰 정보로 인해 느려지는 현상
10842정성태9/1/201520869.NET Framework: 527. 닷넷 사용자 정의 예외 클래스의 최소 구현 코드 - 세 번째 이야기
10841정성태8/31/201530189개발 환경 구성: 276. Visual Studio 2013에서 C# 6과 닷넷 4.6 기능을 사용하려면?
10839정성태8/22/201528768Windows: 112. 윈도우 10에서 터치 키보드를 안 뜨게 할 수 있는 방법 [4]
10838정성태8/22/201539056오류 유형: 304. Windows 10에서 VPN 연결이 실패한다면? [3]
10837정성태8/21/201519345오류 유형: 303. Your computer is low on memory. Save your files and close these programs...
10836정성태8/21/201520286오류 유형: 302. 설치 파일 실행 시 "This app can't run on your PC" 오류가 뜬다면?
10835정성태8/21/201528793웹: 31. Microsoft Edge 브라우저를 명령행에서 띄우는 방법 [1]
10834정성태8/19/201520880.NET Framework: 526. 닷넷 - 값 형식을 new 없이 생성하면 0으로 초기화되지 않는다?
10833정성태8/18/201525494.NET Framework: 525. C# - 닷넷에서 프로세스가 열고 있는 파일 목록을 구하는 방법파일 다운로드1
10832정성태8/17/201529918디버깅 기술: 74. x64 콜 스택 인자 추적과 windbg의 Child-SP, RetAddr, Args to Child 값 확인 [8]파일 다운로드2
10831정성태8/13/201529907.NET Framework: 524. .NET 4.0과 .NET 4.5의 컴파일 결과 차이점 [1]파일 다운로드1
10830정성태8/12/201523904개발 환경 구성: 275. Web.config이 적용되지 않는 프로젝트에서 Razor 템플릿 파일의 C# 컴파일러 버전 제어 [1]
10829정성태8/10/201525995개발 환경 구성: 274. PowerShell/명령행에서 JDK/JRE를 무인(unattended)/자동 설치를 하는 방법 [3]
10828정성태8/10/201531579웹: 30. Edge 브라우저에서 "이 웹 사이트에는 Internet Explorer가 필요함" 단계를 없애는 방법 [1]
10827정성태7/8/201532968개발 환경 구성: 273. Visual Studio 2015에서 Github와 연동하는 방법 [3]
10826정성태7/8/201522587오류 유형: 301. The trust relationship between this workstation and the primary domain failed. - 두 번째 이야기
10825정성태7/8/201522155개발 환경 구성: 272. Visual Studio IDE 설치 없이 Visual Studio SDK 설치하는 방법
10824정성태7/7/201527328개발 환경 구성: 271. Team Foundation Server 2015 설치 방법 [1]
10823정성태7/7/201527897오류 유형: 300. SqlException (0x80131904): Unable to open the physical file
10822정성태7/7/201527258오류 유형: 299. The 'Visual C++ Project System Package' package did not load correctly.
... 121  122  [123]  124  125  126  127  128  129  130  131  132  133  134  135  ...