Thursday, April 28, 2011

Powershell : Getting a list of commands

Powershell is a useful tool if you like a command line interface.

Although it has a pretty comprehensive list of help commands, quite often you can't remember the exact command.

e.g. you remember that the command had the word "item" in it.

So use:

get-command *item*

which gives you a list of all commands that contain the phrase "item".


ADFS : Federating with SelfSTS

SelfSTS is an extremely useful application which simplifies WIF testing by allowing you to define claims without an instance of AD installed.

Given that it supports the WS-Federation protocol, it should in theory be able to be federated with AFDS v2.0. However, in practice, it doesn't fly. ADFS complains that there are unsupported elements in the federation metadata. If you try and import the metadata via a file, ADFS complains that only https URL's are supported. SelfSTS has the common or garden http URL.

However, this article shows how to federate SelfSTS with Azure's Appfabric ACS. Since you can federate ACS with ADFS, you can essentially get the federation working - albeit in a round-about way.


Wednesday, April 06, 2011

ADFS : Setting up a proxy

The instructions on Things to Check Before Troubleshooting AD FS 2.0 specify using proxycfg to change the proxy settings.

However, on Windows 2008 Server R2, this has been deprecated and you need to use Netsh.

Open a command prompt. You need to run as administrator.

C:\>netsh /?

Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]Use
rName] [-p Password | *]
[Command | -f ScriptFile]

The following commands are available:

Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a list of entries.
advfirewall - Changes to the `netsh advfirewall' context.
branchcache - Changes to the `netsh branchcache' context.
bridge - Changes to the `netsh bridge' context.
delete - Deletes a configuration entry from a list of entries.
dhcpclient - Changes to the `netsh dhcpclient' context.
dnsclient - Changes to the `netsh dnsclient' context.
dump - Displays a configuration script.
exec - Runs a script file.
firewall - Changes to the `netsh firewall' context.
help - Displays a list of commands.
http - Changes to the `netsh http' context.
interface - Changes to the `netsh interface' context.
ipsec - Changes to the `netsh ipsec' context.
lan - Changes to the `netsh lan' context.
mbn - Changes to the `netsh mbn' context.
namespace - Changes to the `netsh namespace' context.
nap - Changes to the `netsh nap' context.
netio - Changes to the `netsh netio' context.
p2p - Changes to the `netsh p2p' context.
ras - Changes to the `netsh ras' context.
rpc - Changes to the `netsh rpc' context.
set - Updates configuration settings.
show - Displays information.
trace - Changes to the `netsh trace' context.
wcn - Changes to the `netsh wcn' context.
wfp - Changes to the `netsh wfp' context.
winhttp - Changes to the `netsh winhttp' context.
winsock - Changes to the `netsh winsock' context.
wlan - Changes to the `netsh wlan' context.

The following sub-contexts are available:
advfirewall branchcache bridge dhcpclient dnsclient firewall http interface ips
ec lan mbn namespace nap netio p2p ras rpc trace wcn wfp winhttp winsock wlan

To view help for a command, type the command, followed by a space, and then type ?.

We want the winhttp option:

C:\>netsh winhttp /?

The following commands are available:

Commands in this context:
? - Displays a list of commands.
dump - Displays a configuration script.
help - Displays a list of commands.
import - Imports WinHTTP proxy settings.
reset - Resets WinHTTP settings.
set - Configures WinHTTP settings.
show - Displays currents settings.

To view help for a command, type the command, followed by a space, and then type ?

To see the current proxy, use:

C:\>netsh winhttp show proxy

Current WinHTTP proxy settings:

Direct access (no proxy server).

To set the proxy, use:

C:\>netsh winhttp set proxy /?

Usage: set proxy [proxy-server=] [bypass-list=]


Tag Value
proxy-server - proxy server for use for http and/or https protocol
bypass-list - a list of sites that should be visited bypassing the
proxy (use "" to bypass all short name hosts)


set proxy myproxy
set proxy myproxy:80 ";bar"
set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*"