fix sccm plugin

This commit is contained in:
Colin Gagnaire 2019-06-03 17:36:59 +02:00
parent 67884cd598
commit 5bdc4bd2b4
4 changed files with 37 additions and 11 deletions

View File

@ -199,6 +199,10 @@ sub manage_selection {
$self->{output}->option_exit();
}
if (!defined($decoded->{LinkStatus})) {
$self->{output}->add_option_msg(short_msg => "No database replication");
$self->{output}->option_exit();
}
$self->{global}->{LinkStatus} = $map_link_status{$decoded->{LinkStatus}};
$self->{sites}->{$decoded->{Site1}} = {

View File

@ -161,15 +161,31 @@ sub manage_selection {
$self->{output}->option_exit();
}
foreach my $site (@{$decoded}) {
$self->{sites}->{$site->{SiteCode}} = {
display => $site->{SiteCode},
SiteName => $site->{SiteName},
Type => $map_type{$site->{Type}},
Mode => $map_mode{$site->{Mode}},
Status => $map_status{$site->{Status}},
SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus},
};
if (ref($decoded) eq "ARRAY") {
foreach my $site (@{$decoded}) {
$self->{sites}->{$site->{SiteCode}} = {
display => $site->{SiteCode},
SiteName => $site->{SiteName},
Type => $map_type{$site->{Type}},
Mode => $map_mode{$site->{Mode}},
Status => $map_status{$site->{Status}},
SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus},
};
}
} else {
$self->{sites}->{$decoded->{SiteCode}} = {
display => $decoded->{SiteCode},
SiteName => $decoded->{SiteName},
Type => $map_type{$decoded->{Type}},
Mode => $map_mode{$decoded->{Mode}},
Status => $map_status{$decoded->{Status}},
SecondarySiteCMUpdateStatus => $decoded->{SecondarySiteCMUpdateStatus},
};
}
if (scalar(keys %{$self->{sites}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No sites found.");
$self->{output}->option_exit();
}
}

View File

@ -44,7 +44,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
$module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
$module = ${env:ProgramFiles} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
If (!(Test-Path $module)) {
$module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
}
Import-Module $module
New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null

View File

@ -44,7 +44,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
$module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
$module = ${env:ProgramFiles} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
If (!(Test-Path $module)) {
$module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
}
Import-Module $module
New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null