Skip to content

Commit

Permalink
add force install to inital module connection
Browse files Browse the repository at this point in the history
Signed-off-by: Sujay Kandwal <[email protected]>
  • Loading branch information
skandwal-mitre committed Dec 26, 2024
1 parent 1e965e4 commit 5d3d8e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/train-pwsh/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ def install_connect_graph_exchange()
$organization = '#{@organization}'
#Connect to Graph module
If($null -eq (get-module -listavailable -name "microsoft.graph")){install-module microsoft.graph}
If($null -eq (get-module -listavailable -name "microsoft.graph")){install-module microsoft.graph -Force -AllowClobber}
If($null -eq (get-module -name "microsoft.graph")){import-module microsoft.graph}
$password = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force
$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential($client_id,$password)
Connect-MgGraph -TenantId $tenantid -ClientSecretCredential $ClientSecretCredential -NoWelcome
#Connect to Exchange module
If($null -eq (get-module -listavailable -name "ExchangeOnlineManagement")){install-module ExchangeOnlineManagement}
If($null -eq (get-module -listavailable -name "ExchangeOnlineManagement")){install-module ExchangeOnlineManagement -Force -AllowClobber}
If($null -eq (get-module -name "ExchangeOnlineManagement")){import-module ExchangeOnlineManagement}
$password = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force
$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential($client_id,$password)
Expand All @@ -131,13 +131,13 @@ def install_connect_teams_pnp()
$sharepoint_admin_url = '#{@sharepoint_admin_url}'
#Connect to Teams module
If($null -eq (get-module -listavailable -name "MicrosoftTeams")){install-module MicrosoftTeams}
If($null -eq (get-module -listavailable -name "MicrosoftTeams")){install-module MicrosoftTeams -Force -AllowClobber}
If($null -eq (get-module -name "MicrosoftTeams")){import-module MicrosoftTeams}
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certificate_path,$certificate_password)
Connect-MicrosoftTeams -Certificate $cert -ApplicationId $client_id -TenantId $tenantid > $null
#Connect to PnP module
If($null -eq (get-module -listavailable -name "PnP.PowerShell")){install-module PnP.PowerShell}
If($null -eq (get-module -listavailable -name "PnP.PowerShell")){install-module PnP.PowerShell -Force -AllowClobber}
If($null -eq (get-module -name "PnP.PowerShell")){import-module PnP.PowerShell}
$password = (ConvertTo-SecureString -AsPlainText $certificate_password -Force)
Connect-PnPOnline -Url $sharepoint_admin_url -ClientId $client_id -CertificatePath $certificate_path -CertificatePassword $password -Tenant $tenantid
Expand Down
2 changes: 1 addition & 1 deletion lib/train-pwsh/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Train
module Pwsh
VERSION = "0.1.4"
VERSION = "0.1.5"
end
end

0 comments on commit 5d3d8e8

Please sign in to comment.