PowerShell Proxy | How to set proxy for current session or permanently
01kg
Posted on August 20, 2024
TL;DR
Key code:
$proxyUrl = "http://your-proxy-url:port"
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy($proxyUrl)
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Replace "http://your-proxy-url:port" with your own proxy url and port.
For current session:
Input key code into your current PowerShell session.
Permanently
- Use Notepad to edit PowerShell Profile:
notepad $PROFILE
-
Optional: If File Explorer alert that cannot find this file, you should create One:
New-Item -Path $PROFILE -ItemType File -Force
- Add key code into this profile. Save.
- Open a new PowerShell session to apply this change
-
Optional: If an error message indicates that the execution of scripts is disabled on your system due to the current PowerShell execution policy in the new session, do:
- Right-click on the PowerShell icon and select "Run as Administrator".
- Run the following command to set the execution policy to RemoteSigned, which allows scripts created on your local computer to run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
💖 💪 🙅 🚩
01kg
Posted on August 20, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024