PowerShell: 통합 문서 클래스의 open 속성을 가져올 수 없습니다.

PowerShell: 통합 문서 클래스의 open 속성을 가져올 수 없습니다.

그래서 PowerShell을 사용하여 Excel 파일을 열려고 합니다. 하지만 "통합 문서 클래스의 공개 속성을 가져올 수 없습니다."라는 오류 메시지가 나타납니다.

$dirPath = ("C:\Users\localadmin\OneDrive\DailyReports\")
$manFile = Get-ChildItem -Path $dirPath -Recurse -Filter "*MANSUM*"
$manPath = $manFile.Fullname
$excel = New-Object -ComObject Excel.Application
$excel.DisplayAlerts = $false
$manWB = $excel.Workbooks.Open($manPath)

이 오류를 어떻게 해결할 수 있나요?

전체 경로( $manPath)가 정확합니다.

Windows 10 Pro, Excel 2016 실행

답변1

해결책은 다음과 같습니다.

폴더를 생성하고 적절한 접근 권한을 제공해야 합니다.

・윈도우 2008 서버 x64

이 폴더를 만들어주세요.

C:\Windows\SysWOW64\config\systemprofile\Desktop

・윈도우 2008 서버 x86

이 폴더를 만들어주세요.

C:\Windows\System32\config\systemprofile\Desktop

나타내다: https://social.msdn.microsoft.com/Forums/en-US/b81a3c4e-62db-488b-af06-44421818ef91/excel-2007-automation-on-top-of-a-windows-server-2008-x64? 포럼=innovateonoffice

관련 정보