======Microsoft - Scripting - PowerShell - Snippets - Import Module====== Check if a particular module, in this case BitsTransfer, is loaded, and if not load it. $objModuleLoaded = Get-Module BitsTransfer if (-Not $objModuleLoaded) { $strMsg = "Loading BitsTransfer module." Write-Host Write-Host $strMsg try { Import-Module BitsTransfer -ErrorAction Stop } catch { $strMsg = "Could not load BitsTransfer PowerShell module. Ending script." Write-Host $strMsg -ForeGroundColor Red Write-Host $Error[0] -ForeGroundColor Red Exit } }