Powershell script to Upload log file from local system to http URL -
how upload log file local system webpage (http://abc..) using powershell script? in advance
if using http, try this:
$sourcefilepath = "c:\mylocalfolder\locallogfilename.log" $siteaddress = "http://192.168.15.12/destinationfolder" $urldest = "{0}/{1}" -f ($siteaddress, "destinationlogfilename.log"; $webclient = new-object system.net.webclient; $webclient.credentials = new-object system.net.networkcredential("myusername", "mypassword"); ("*** uploading {0} file {1} ***" -f ($sourcefilepath, $siteaddress) ) | write-host -foregroundcolor green -backgroundcolor yellow $webclient.uploadfile($urldest, "put", $sourcefilepath);
Comments
Post a Comment