Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

PowerShell – Get WebAdministration

Posted on March 14, 2016 By David Kittell

If you are on a newly installed server and trying any of the IIS PowerShell scripts on this site that call “Import WebAdministration” you may have some issues if the “WindowsPowerShellWebAccess” feature isn’t installed, this script below should help.

clear

try
	{
		$ImportSucceeded = import-module WebAdministration -ErrorAction Stop
	}
catch
	{
		Write-Output "Unable to Import"

		try
			{
				$AddSucceeded = add-pssnapin WebAdministration -ErrorAction Stop
			}
		catch
			{
				Write-Output "Unable to Add PS Snapin"
				try
					{
						$AddFeatureSucceeded =  Add-WindowsFeature WindowsPowerShellWebAccess -ErrorAction Stop
					}
				catch
					{
						Write-Output "Unable to Add PS Feature"
						Write-Output $PSVersionTable
					}
			}

		# Break
	}
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code PowerShell iisPowerShell Try CatchWebAdministrationWindowsPowerShellWebAccess

Post navigation

Previous post
Next post

Related Posts

PowerShell – Check DNS For Skype For Business

Posted on May 21, 2018

## CallTower PowerShell DNS Checker, This script checks all that you have all your DNS entries in place and displays the final route for DNS lookups. ## ## Usage .\Check-SRVRecords.ps1 -domain calltower.com ## ## Original Script Obtained From: https://www.uc.solutions/Skype_for_Business/Skype4B_Set_Up/How_to_verify_or_set_DNS_records_for_Skype_for_Business ## param($domain = (Get-WmiObject win32_computersystem).Domain) $cnameresult = Resolve-DnsName sip.$domain -Server 8.8.8.8…

Read More

Ektron – DMS Content List

Posted on October 31, 2014October 26, 2015

<%@ Page Title="" Language="C#" CodeFile="DMSFileList.aspx.cs" Inherits="DMSFileList" %> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <meta charset="utf-8" /> <title>DMS File List</title> </head> <body> <form id="form1" runat="server"> <asp:Repeater ID="subContentRepeater" runat="server"> <HeaderTemplate> <table style="border: 1px solid #000000;"> <tr> <th>ID</th> <th>Type</th> <th>QuickLink</th> <th>Title</th> <th>Summary</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td style="vertical-align: text-top;"> <%# DataBinder.Eval(Container.DataItem,…

Read More

Mac OSX Terminal – Change/Set DNS

Posted on May 27, 2016June 4, 2020

This may need to change depending on your network interface Manual Process # Only friendly names networksetup -listallnetworkservices # Useful information networksetup -listallhardwareports Running the above will display something like this An asterisk (*) denotes that a network service is disabled. Ethernet FireWire Wi-Fi Bluetooth PAN Thunderbolt Bridge # Optional…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes