I have the powershell below that prompt me for my credential once, then run / export SCCM report which work great for me but for my colleague, he is prompt twice before that export start.
I do not see where my mistake is, can you help?
function get-Report([String] $reportID, [String] $destination)
$url = "http://xx.x.xx.xx/SMSReporting_CS1/Report.asp?ReportID=$reportID"
$xhttp = new-object -com msxml2.xmlhttp
#this sends the request to perform a CSV export
#This line's not needed but I use it to get confirmation
#that the download is queued correctly. If not OK then
#I know to check the above part of this script
Write-Host "$url - result: $($xhttp.statustext)"
#Now grab the file in the buffer and save it to disk
$stream = new-object -com ADODB.Stream
$stream.type = 1
#Connect the buffer to the downloaded file
$stream = $nul
$Cred = get-credential
get-SCCMReport 774 "\\pick01\Doc\Dev\HC001.csv"
get-SCCMReport 779 "\\pick01\Doc\Dev\HC002.csv"
get-SCCMReport 776 "\\pick01\Doc\Dev\HC003.csv"