From slakan, 5 Years ago, written in PowerShell.
Embed
  1. # Needed once
  2. $Creds = Get-Credential
  3. ($Creds).Password|ConvertFrom-SecureString | set-content C:\temp\webfiles.txt
  4.  
  5. # Used everytime
  6. $User = ""
  7. $password = Get-Content C:\Temp\webfiles.txt | ConvertTo-SecureString
  8. $credential = New-Object System.Management.Automation.PsCredential($User,$password)
  9.  
  10. # Magic
  11. $Content = Invoke-WebRequest -Credential $credential http://strandbo.org/webfiles/simple.xml -AllowUnencryptedAuthentication
  12.  
  13.