Intune Initial Scripts Backup

This commit is contained in:
2025-04-21 14:21:38 -04:00
commit 71764cd10f
241 changed files with 28218 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
<#
Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
New-PSDrive -Name SCCM-Drive -PSProvider "AdminUI.PS.Provider\CMSite" -Root "PNCRASCCM001.ccx.carecentrix.com" -Description "SCCM Site"
#>
# $DeviceCollection_Name = "Nabil - Test Collection"
<#
$DeviceCollection_Name = "All - Inventory - Supporting Infrastructure"
$DeviceCollection_Name = "Stage 2. ADR - QA Servers"
$DeviceCollection_Name = "Stage 3. ADR - PRD Servers - Set 2"
$DeviceCollection_Name = "Stage 3. ADR - PRD Servers - Set 1"
$DeviceCollection_Name = "Stage 1. ADR - DEV Servers - Set 1"
#### $DeviceCollection_Name_ALL = "All - Inventory - Infrastructure Servers",
"All - Inventory - Supporting Infrastructure",
"All - Inventory - Database",
"All - Inventory - Application Servers"
#>
<#
CD sccm-drive:
$DeviceCollection_MemberCount = Get-CMDeviceCollection -Name $DeviceCollection_Name | select Name,MemberCount
$DeviceCollection_ServerNames = Get-CMCollectionMember -CollectionName $DeviceCollection_Name | select Name,IsClient #| Export-Csv "E:\SCCM-Files\SCCM-Scripts\Files\$DeviceCollection_Name.csv" -NoTypeInformation
$ServerName = $DeviceCollection_ServerNames.Name
$ServerName.count
Set-Location c:
#>
#$DeviceCollection_Name = ""
CD sccm-drive:
$DeviceCollection_MemberCount = Get-CMDeviceCollection -Name $DeviceCollection_Name | select Name,MemberCount
$DeviceCollection_ServerNames = Get-CMCollectionMember -CollectionName $DeviceCollection_Name | select Name,IsClient #| Export-Csv "E:\SCCM-Files\SCCM-Scripts\Files\$DeviceCollection_Name.csv" -NoTypeInformation
$ServerName = $DeviceCollection_ServerNames.Name
$ServerName.count
Set-Location c:
#$No_Client = $DeviceCollection_ServerNames | ? { $_.IsClient -eq $false }
#$No_Client.count
# Test-Connection -ComputerName $No_Client.name -Count 1
$Script:ALL_Patch_Servers = @()
$Script:Temp = @()
Function ALL_Patching_Servers {
Param($Coll_Name)
CD sccm-drive:
$Script:Temp = Get-CMCollectionMember -CollectionName $Coll_Name #| select Name,IsClient
$Temp | % {
$Obj = New-Object -TypeName PSObject
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $_.Name
$Obj | Add-Member -MemberType NoteProperty -Name ClientInstalled -Value $_.IsClient
$Obj | Add-Member -MemberType NoteProperty -Name CollectionName -Value $Coll_Name
#$Obj | Add-Member -MemberType NoteProperty -Name CollectionMemberCount -Value {(Get-CMCollectionMember -Name $Coll_Name).MemberCount}
$Obj
$Script:ALL_Patch_Servers += $Obj
}#end%
}#endFunction
#$DeviceCollection_Name_ALL | % { ALL_Patching_Servers -Coll_Name $_ }
$DeviceCollection_Name | % { ALL_Patching_Servers -Coll_Name $_ | sort Server}
Set-Location c: