diff --git a/TeamViewerADConnector/Invoke-InstallTeamViewerPSModule.ps1 b/TeamViewerADConnector/Invoke-InstallTeamViewerPSModule.ps1 index b9c420d..f5f1531 100644 --- a/TeamViewerADConnector/Invoke-InstallTeamViewerPSModule.ps1 +++ b/TeamViewerADConnector/Invoke-InstallTeamViewerPSModule.ps1 @@ -3,9 +3,9 @@ param( [string]$ModuleName = 'TeamViewerPS' ) -if (-not (Get-Module -Name $ModuleName -ErrorAction SilentlyContinue)) { +if (-not (Get-InstalledModule -Name $ModuleName -ErrorAction SilentlyContinue)) { try { - Import-Module -Name $ModuleName -ErrorAction Stop + Install-Module -Name $ModuleName -Force -ErrorAction Stop Write-Verbose "Module $Modulename was succesfully installed" } catch {