C
C
Cole2016-02-10 08:49:28
PowerShell
Cole, 2016-02-10 08:49:28

Why do the files created by the script disappear?

Good afternoon!
Is on the server on Windows 2008 R2. It is necessary to upload exchange rates to it daily from the website of the Central Bank. I made a powershell script that loads them in xml format:
Function Get-Webclient ($url, $out) {
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache ]::DefaultCredentials
$request = New-Object System.Net.WebCLient
$request.UseDefaultCredentials = $true ## Proxy credentials only
$request.Proxy.Credentials = $request.Credentials
$request.DownloadFile($url, $out)
}
Get-Webclient " www.cbr.ru/scripts/XML_dynamic.asp?date_req1=11/02... " "C:\temp\R01035.xml"
Get-Webclient "www.cbr.ru/scripts/XML_dynamic.asp?date_req1=11/02... " "C:\temp\R01215.xml"
Get-Webclient " www.cbr.ru/scripts/XML_dynamic.asp?date_req1=11 /02... " "C:\temp\R01235.xml"
Get-Webclient " www.cbr.ru/scripts/XML_dynamic.asp?date_req1=11/02... " "C:\temp\R01239.xml "
Get-Webclient" www.cbr.ru/scripts/XML_dynamic.asp?date_req1=11/02... ""C:\temp\R01775.xml"
The result should be 4 files in the c:\temp folder
. on its own behalf, running on behalf of a special account - everything works correctly, files are created.
But, as soon as this task is launched from the scheduler under the same specialized account, files are created and disappear. Why? What needs to be done so that they do not disappear?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
Cole, 2016-02-10
@Cole

Found wget for Windows. Everything is simple there.

O
oia, 2016-02-10
@oia

Is there a permission for the package?

A
Alexey, 2016-02-10
@skazi_premiere

I would dig towards Export-CliXML and give the received information as an object. PS he is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question