22 lines
876 B
PowerShell
22 lines
876 B
PowerShell
## TODO: Convert this module to use WebAdministration instead of the DLL below.
|
|
try {
|
|
Add-Type -Path (Get-ChildItem -Path "C:\Windows\assembly\" -Include "Microsoft.Web.Administration.dll" -Recurse).FullName
|
|
}
|
|
catch {
|
|
try {
|
|
# Just in case we have IIS Express and IIS loaded (dev machines)
|
|
[System.Reflection.Assembly]::LoadFile("C:\Windows\system32\inetsrv\Microsoft.Web.Administration.dll")
|
|
} catch {
|
|
# Do nothing in case this is a brand new server
|
|
Write-Warning "[Alkami.PowerShell.IIS] : Unable to Load Assembly Microsoft.Web.Administration. Some functions may not work as expected."
|
|
}
|
|
}
|
|
|
|
try {
|
|
Import-Module WebAdministration
|
|
}
|
|
catch {
|
|
# Do nothing in case this is a brand new server
|
|
Write-Warning "[Alkami.PowerShell.IIS] : Unable to Load Module WebAdministration. Some functions may not work as expected."
|
|
}
|