스마트 카드 사용은 기본적으로 인증서가 필요한 웹 사이트와 동일하게 취급됩니다.
스마트 카드 인증을 사용하여 SharePoint에서 파일을 다운로드하려면 아래 코드를 사용하십시오. 요구 사항을 충족 시키려면 Invoke-WebRequest
을 수정하면됩니다.
Add-Type -AssemblyName System.Security
# Filtering for cert requirements...
$ValidCerts = [System.Security.Cryptography.X509Certificates.X509Certificate2[]](dir Cert:\CurrentUser\My | where { $_.NotAfter -gt (Get-Date) })
# You could check $ValidCerts, and not do this prompt if it only contains 1...
$Cert = [System.Security.Cryptography.X509Certificates.X509Certificate2UI]::SelectFromCollection(
$ValidCerts,
'Choose a certificate',
'Choose a certificate',
'SingleSelection'
) | select -First 1
$WebRequestParams = @{
Uri = $Url # Uri to file to download
OutFile = $Path # Path to where file should be downloaded (include filename)
Certificate = $Cert
}
Invoke-WebRequest @WebRequestParams
안녕하세요, 어떻게 든 작동하지 않습니다 ... 여전히 잘못된 자격 증명을 보낸 응답을받는 중입니다. – mrGo