if( -not (Get-Command Join-String -ErrorAction SilentlyContinue) ) { if( -not (Get-Module -ListAvailable -Name "string") ) { Write-Warning 'Join-String Command is missing, attempting to install stirng module' $local:moduleScope = "CurrentUser" if( Test-IsAdmin ) { $moduleScope = "AllUsers" } Install-Module -Name "string" -Scope $moduleScope -AllowClobber -ErrorAction SilentlyContinue } if( -not (Get-Module -ListAvailable -Name "string") ) { Write-Error "Failed to locate/install the module 'string'" } Import-Module -Name "string" -Cmdlet "Join-String" }