UI/_OnADLookupsSourceInitialized.ps1
function _OnADLookupsSourceInitialized { $ADLookups_StatusStatusBarItem.Content = "Running as $UserName" $ADLookups_FindTabInformationTextBox.Text = 'Please wait while loading...' #region DC Settings Write-Verbose 'Loading DCs' $DCs = Get-ADDomainController @GetObjectSplat -Filter * foreach ($DC in $DCs) { $ADLookups_OptionTabDCComboBox.Items.Add($DC.Name) } $ADLookups_OptionTabDCComboBox.Text = $STTSettings.DCSettings.DomainController $ADLookups_ConnectedDCStatusBarItem.Content = "Connected to: $($STTSettings.DCSettings.DomainController)" #endregion #region Stored Objects Write-Verbose 'Searching Objects' $ADLookups_OptionsTabObjectCacheTextBox.Text = $STTSettings.ObjectsSettings.ObjectStorageFolder _UpdateObjectCache #endregion #region SCCM Settings Write-Verbose 'Loading SCCM' switch ($STTSettings.FeatureSettings.SCCM) { $true { $ADLookups_UpdateSCCMDevicesMenuItem.IsEnabled = $true $ADLookups_OptionsTabSCCMServerTextBox.IsEnabled = $true $ADLookups_OptionTabSCCMCollectionComboBox.IsEnabled = $true $ADLookups_ComputerTabSCCMCollectionsTabItem.Visibility = "Visible" $ADLookups_UserTabSCCMCollectionTabItem.Visibility = "Visible" try { $SCCMCollections = _GetSCCMInformationQuerySTT -Route wmi -Connector 'SMS_Collection' | Sort-Object } catch { $ADLookups_FindTabInformationTextBox.Text = "Unable to get collections from SCCM.`nVerify that you have permissions to read SCCM." } if ($SCCMCollections) { foreach ($Collection in $($SCCMCollections | Sort-Object Name)) { $ADLookups_OptionTabSCCMCollectionComboBox.Items.Add($Collection.Name) } $ADLookups_OptionTabSCCMCollectionComboBox.SelectedItem = $STTSettings.SCCMSettings.SCCMDefaultCollection } else { $ADLookups_OptionTabSCCMCollectionComboBox.Text = 'Unable to load.' } $ADLookups_OptionsTabSCCMServerTextBox.Text = $STTSettings.SCCMSettings.SCCMServerHostname } $false { $ADLookups_UpdateSCCMDevicesMenuItem.IsEnabled = $false $ADLookups_OptionsTabSCCMServerTextBox.IsEnabled = $false $ADLookups_OptionTabSCCMCollectionComboBox.IsEnabled = $false $ADLookups_ComputerTabSCCMCollectionsTabItem.Visibility = "Hidden" $ADLookups_UserTabSCCMCollectionTabItem.Visibility = "Hidden" } } #endregion $ADLookups_FindTabInformationTextBox.Text = '' Write-Verbose 'Loading Complete' } |