Configure Internet Access for Server behind TMG 2010

Posted: July 22, 2015 in Systems Administration
Tags:

PowerShellHey everybody,

I was recently configuring a server for a client and I needed to access the Internet, after snooping a bit I found that they were using TMG 2010 as a proxy server, long story short the Admin in charge of access was not available. I remember stumbling upon a power shell command that would enable the server to go through the Proxy and with the correct credentials travel to the internet.

I opened up PowerShell as an administrator

PowerShell

2. Executed “Netsh winhttp show proxy” to view current proxy setting for the server. (remove the quotation marks before executing on powershell)

DirectAccessNoProxy

3. Executed command “Netsh winhttp import proxy source=ie” ( in this case Internet Explorer already had the Proxy Settings, I am just importing it from there)

4. Since I needed credentials to go to the Internet (TMG had no rule to allow this server to access Internet directly) I executed the following commands:

$webclient=New-Object System.Net.WebClient

$creds=Get-Credential

Credentials

(lucky for me the Active Directory administrator was available and had a service account with access to Internet via TMG)

$webclient.Proxy.Credentials=$creds

After that is was smooth sailing, you can also do this on Server 2012 Servers where you need to add features that are downloaded form the Internet.

ENJOY!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s