void Main() { if (!IsRunningAsAdmin()) { "To manage IIS run LINQPad as administrator.".Dump(); return; } var serverManager = new ServerManager(); var sites = new[] { new { Index = 0, Name = string.Empty } } .AsEnumerable(); var sites = serverManager .Sites .Select((site, index) => new { Index = ++index, Name = site.Name }) .OrderBy(site => site.Name) .Dump(); Console.WriteLine("Select the website to get bindings information:"); var websiteIndex = int.Parse(Console.ReadLine()); var siteName = sites.Single(x => x.Index == websiteIndex).Name; serverManager .Sites .Single(s => s.Name == siteName) .Bindings.Select(x => x.BindingInformation).Dump(); } private bool IsRunningAsAdmin() { var isAdmin = false; var currentIdentity = WindowsIdentity.GetCurrent(); if (currentIdentity != null) { WindowsPrincipal pricipal = new WindowsPrincipal(currentIdentity); isAdmin = pricipal.IsInRole(WindowsBuiltInRole.Administrator); pricipal = null; } return isAdmin; }