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 }