Skip to content

Instantly share code, notes, and snippets.

@1RedOne
Created October 4, 2016 17:39
Show Gist options
  • Select an option

  • Save 1RedOne/e65154eaf6fdb189ab769dc36f91fa1e to your computer and use it in GitHub Desktop.

Select an option

Save 1RedOne/e65154eaf6fdb189ab769dc36f91fa1e to your computer and use it in GitHub Desktop.
Automatic Client Upgrade
$code = 'Your Three digit site code'
while ($true){
$c= Get-CMCollection -Name 'Clients with < SCCM Version 1511' | select -expand MemberCount;
$d = Get-CMCollection -Name 'Clients with > SCCM Version 1511' | select -expand MemberCount;
$x = get-random -maximum 10 -minimum 1
"trying another $x clients"
$r = get-cmdevice -CollectionName 'Clients with < SCCM Version 1511' | get-random -count $x
$r | %{
Install-CMClient -DeviceName $_.Name -SiteCode $code -ForceReinstall $true -AlwaysInstallClient $True -IncludeDomainController $False
}
"Less than 1511 `t:$c"
"More than 1511 `t:$d"
timeout 180
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment