I have a batch script that calls a Sharepoint web service SPDocumentDownloader.exe. The web service extracts a document from a sharepoint library and copies the document to a file share. When the SPDocumentDownloader.exe is run from the command line it works successfully. However when it is run from Powershell using the scripts below it completes without an error but does not extract the document from the library and copy it to the file share. Do you know what the issue is and how to fix this?
DownloadCSRPDocument.bat:
SET PATH=%PATH%%SystemRoot%\System32;%SystemRoot%\system32\WindowsPowerShell\v1.0\;
set
whoami
set TMP=s:\apps\sharepoint\Temp
powershell -executionpolicy ByPass s:\apps\sharepoint\DownloadCSRPDocumentSP2010.ps1
DownloadCSRPDocumentSP2010.ps1:
# The document is downloaded to path defined in config file SPDocumentDownloader.exe.config
$Site = 'https://txportal.ire.ite.int/orgs/TP/TPC/CSRP'
$Library = 'CSRP Document Library'
$Document = '08TX-13646 Agreement Executed 10-15-08.pdf'
$GLOBAL:priority="normal"
$d = Get-Date
$Date = $d.ToShortDateString()
$Time = $d.ToShortTimeString()
PWD
whoami
#Display Message to Screen
Write-Output "Extracting document $Document from library $Library on Sharepoint site $Site @ $date"
$ConfigPath = 'S:\apps\sharepoint\'
$ConfigPathAndFile = 'S:\apps\sharepoint\SPDocumentDownloader.exe'
$ConfigFile = 'DefaultConfig.txt'
$LogFile = 'CSRPMsg.log'
$MessageFile = 'CSRPMsgDefaults.txt'
# SPDocumentDownloader.exe https://txportal.ire.ite.int/orgs/TP/TPC/CSRP “CSRP Document Library” “08TX-13646 Agreement Executed 10-15-08.pdf”
Start-Process -Filepath $ConfigPathAndFile -ArgumentList "$Site $Library $Document" -WorkingDirectory $ConfigPath -NoNewWindow -Wait
"Finished with Processing" | Out-File -FilePath $ConfigPath$LogFile
Aucun commentaire:
Enregistrer un commentaire