Showing posts with label SCCM. Show all posts
Showing posts with label SCCM. Show all posts

Sunday, July 31, 2016

PowerShell: Manipulate Workstation Software Information via SCCM

During the computer replacement cycle, a typical chore is retrieving the software list from the old computer and ensuring its replacement computer gets said software.  If SCCM packages are involved, there are two sources to check during this process: The local repository and the SCCM assigned repositories.

To help with this process, as well as other similar software management functions, I created a script which collects the existing computers SCCM packages and transfers them to the new computer, views SCCM's list of local software, removes a SCCM package from a computer, edit/update the SCCM list table, and change computer numbers so you can look at another computer without leaving the script.

Now, this script, just like my others, are works in progress.  As such, they might have errors in your environment.  I wanted to share what I have in case it might help others with their daily duties.  Please let me know if you have improvements.

$tagnumber = read-host "Enter Computer Tag"
$computername = $tagnumber.toupper()
$SCCMserver = "DomainSCCMServer01"
$namespace = "root\sms\site_xx1"
$Server = "DomainGCServer01"
$i = 0

#pulling in existing administrative credentials for $admcred variable
if (test-path \\server\share\it_tools\1p.eee){
$name = "domain\admin01"
$password = get-content \\server\share\it_tools\1p.eee|convertto-securestring -key (1..16)
$admcred = new-object system.management.automation.pscredential($name,$password)
}

#Testing if the admin password has expired
$ServerTest = new-psdrive -name test -root \\DomainSCCMServer01\client -credential $admcred -psprovider FileSystem
#Testing if 1p.eee password file exists
$PWTest = test-path \\server\share\it_tools\1p.eee

#if either of the above commands fail, the admin gets prompted to update/add their admin credential
if (($PWTest -ne $true) -or ($ServerTest.name -ne "test")){
$admcred = get-credential -username "domain\adm_youraccount" -message "Update your ADM Password"
$password = $admcred.password|convertfrom-securestring -key (1..16)
$password|out-file \\server\share\it_tools\1p.eee
$password = gc \\server\share\it_tools\1p.eee|convertto-securestring -key (1..16)
$admcred = new-object system.management.automation.pscredential($name,$password)
}
remove-psdrive test


#SCCM
#Getting list of current software collections
#and then filtering out unneeded collections
if (test-connection $SCCMServer){
$xlist = import-csv \\server\share\it_tools\offlist.csv
$CollectionList = gwmi -query "Select * from SMS_Collection" -namespace $namespace -computername $SCCMserver -credential $admcred
$CollectionList = $CollectionList|? {$xlist.name -notcontains $_.name}
foreach ($C in $CollectionList){$i++;$C|add-member -notepropertyname line -notepropertyvalue $i}
}

do{
#SCCM Collection Query
$CurrentApps = Get-WmiObject -Namespace $namespace -Class SMS_fullcollectionmembership -ComputerName $SCCMServer -filter "Name = '$computername'" -credential $admcred

#Applying current computer software list to complete software list
$InstalledSoftwareList = $CollectionList|? {$CurrentApps.collectionID -contains $_.collectionID}

#Querying SCCM for main user of selected computer
$users = gwmi -computername $sccmserver -namespace $namespace -class sms_usermachinerelationship -filter "resourcename = '$computername'"
$userlist = $users|% {get-aduser $_.uniqueusername.split('\')[1]|select givenname,surname,name}

write-host "Available SCCM Software Packages" -f white
$collectionlist|? {$InstalledSoftwareList.name -notcontains $_.name}|format-table line,name -autosize -hidetableheaders
write-host ("Current SCCM Packages for " + $computername + ":") -f white
$InstalledSoftwareList|format-table line,name -hidetableheaders -autosize

#Adds the following if a software from the collection has been added to the install list
if ($newsoftware){
write-host "Software to be added" -f yellow
$newsoftware|format-table line,name -hidetableheaders -autosize
}

#Shows users of selected computer
write-host "User Profiles on $computername" -f white
$userlist|format-table -autosize -hidetableheaders

#Menu
write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to add SCCM software to $computername"
write-host "Enter " -nonewline;write-host "LOCAL" -f white -nonewline;write-host " to view local software on $computername"
write-host "Enter " -nonewline;write-host "REMOVE" -f white -nonewline;write-host " to remove SCCM software from $computername"
write-host "Enter " -nonewline;write-host "EDIT" -f white -nonewline;write-host " to update your SCCM Package Filter"
write-host "Enter " -nonewline;write-host "TRANSFER" -f white -nonewline;write-host " to add $computername software to another computer"
write-host "Enter " -nonewline;write-host "CHANGE" -f white -nonewline;write-host " to change computer"
if ($transfername){
write-host ($transfername + " SCCM App List:")
$installedapps.name}

write-host "Enter " -nonewline;write-host "DONE" -f white -nonewline;write-host " to add software and finish script"
$addpackages = read-host "(Line number, Local, Remove, Edit, Transfer, Change, or Done)"

## CHANGE ##
if ($addpackages -eq "change"){
$tagnumber = read-host "Enter Computer Tag"
$computername = $tagnumber.toupper()
}

## LOCAL ##
if ($addpackages -eq "local"){
$i = 0
$localxlist = import-csv \\server\share\it_tools\offlocalsoftwarelist.csv
$oldcomputerlocalsoftware = gwmi -computername $sccmserver -namespace $namespace -Query ("select InstalledLocation, ProductVersion, ProductName from SMS_R_System join SMS_G_SYSTEM_Installed_Software on SMS_R_System.ResourceID = SMS_G_SYSTEM_Installed_Software.ResourceID where SMS_R_SYSTEM.Name= ""$($computername)"" ") -credential $admcred
$oldcomputerlocalsoftware = $oldcomputerlocalsoftware|? {$localxlist.productname -notcontains $_.productname -and $localxlist.productversion -notcontains $_.productversion}
foreach ($C in $oldcomputerlocalsoftware){$i++;$C|add-member -notepropertyname line -notepropertyvalue $i}

do{
#local software menu.  It also has a filter to exclude unwanted software from its list
write-host "`nLocal software found on $SCCMOldComputer"
$oldcomputerlocalsoftware|format-table line,productname,productversion -hidetableheaders -autosize
if ($removesoftware){write-host "Will be added to local filter list:" -f green}
if ($removesoftware){$removesoftware|format-table -hidetableheaders -autosize}
write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to update local software exclusion filter"
write-host "Enter " -nonewline;write-host "Return" -f white -nonewline;write-host " if list is correct"
$addtolxlist = read-host "(Line number or Return)"
if ($addtolxlist -ne "return"){
[array]$removesoftware += $oldcomputerlocalsoftware|? line -eq $addtolxlist|select productname,productversion
$oldcomputerlocalsoftware = $oldcomputerlocalsoftware|? {$removesoftware.productname -notcontains $_.productname -and $removesoftware.productversion -notcontains $_.productversion}
}
} while ($addtolxlist -ne "return")
if ($removesoftware){
$localxlist = $localxlist|select ProductName,ProductVersion
$localxlist += $removesoftware|select ProductName,ProductVersion
$localxlist|export-csv \\server\share\it_tools\offlocalsoftwarelist.csv
$removesoftware = $nul
}

}

## REMOVE ##
if ($addpackages -eq "remove"){

do{
#cls
write-host "SCCM Software already installed on $computername" -f white
$InstalledSoftwareList|format-table line,name -hidetableheaders

if ($removesoftware){
write-host "Software to be removed" -f yellow
$removesoftware|format-table line,name -hidetableheaders
}

write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to remove SCCM software from $computername"
write-host "Enter " -nonewline;write-host "REMOVE" -f white -nonewline;write-host " if satisfied with removal list"
$removepackages = read-host "(Line number or Remove)"

if ($removepackages -ne "remove"){
[array]$removesoftware += $collectionlist|? line -eq $removepackages
}

} while ($removepackages -ne "Remove")

if ($removesoftware){
foreach ($r in $removesoftware){
$ID = $r.collectionID
$Collection = gwmi -class SMS_Collection -namespace $namespace -computername $SCCMserver -credential $admcred|? CollectionID -eq $ID
$ruleclass = gwmi -namespace $namespace -class "SMS_CollectionRuleDirect" -computername $SCCMserver -list -credential $admcred
$RemoveComputer = gwmi -ComputerName $SCCMServer -Namespace $Namespace -Class "SMS_R_System" -Filter "Name = '$($computername)'" -credential $admcred
$DelRule = $RuleClass.CreateInstance()     
$DelRule.RuleName = $($RemoveComputer.name)
$DelRule.ResourceClassName = "SMS_R_System" 
$DelRule.ResourceID = $($RemoveComputer.resourceid)
$Collection.DeleteMemberShipRule($DelRule)
$Collection.requestrefresh()
}
}

## EDIT ##
if ($addpackages -eq "edit"){
do{
write-host "Current SCCM Package Filter" -f white
$CollectionList|format-table line,name -hidetableheaders -autosize
if ($updatexlist){write-host "Will be added to filter:" -f green}
if ($updatexlist){$updatexlist|format-table -hidetableheaders -autosize}
write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to remove from list"
write-host "Enter " -nonewline;write-host "Update" -f white -nonewline;write-host " to execute filter update"
$addtoxlist = read-host "(Line number or Update)"
if ($addtoxlist -ne "update"){
[array]$remove += $CollectionList|? line -eq $addtoxlist|select name,collectionID
[array]$UpdateXList = $CollectionList|? line -eq $addtoxlist|select line,name
}
} while ($addtoxlist -ne "update")
#saving updated collectionlist

if ($remove){
$xlist = $xlist|select Name,CollectionID
$xlist += $remove|select Name,CollectionID
$xlist = $xlist|sort CollectionID -unique
$xlist|export-csv \\server\share\it_tools\offlist.csv
write-host "Filter updated" -f green}
}
}

## TRANSFER ##
if ($addpackages -eq "transfer"){
$transfercomputer = read-host "Transfer to Tag Number"
$transfername = $transfercomputer.toupper()
foreach ($c in $InstalledSoftwareList){
$ID = $c.collectionID
$Collection = gwmi -class SMS_Collection -namespace $namespace -computername $SCCMserver -credential $admcred|? CollectionID -eq $ID
$ruleclass = gwmi -namespace $namespace -class "SMS_CollectionRuleDirect" -computername $SCCMserver -list -credential $admcred
$AddComputer = gwmi -ComputerName $SCCMServer -Namespace $Namespace -Class "SMS_R_System" -Filter "Name = '$($transfername)'" -credential $admcred
$NewRule = $RuleClass.CreateInstance()     
$NewRule.RuleName = $($AddComputer.name)
$NewRule.ResourceClassName = "SMS_R_System" 
$NewRule.ResourceID = $($AddComputer.resourceid)
$Collection.AddMembershipRules($newrule)
$Collection.requestrefresh()
}
$CheckApps = Get-WmiObject -Namespace $namespace -Class SMS_fullcollectionmembership -ComputerName $SCCMServer -filter "Name = '$transfername'" -credential $admcred
$InstalledApps = $CollectionList|? {$CheckApps.collectionID -contains $_.collectionID}
}

if (($addpackages -ne "done") -and ($addpackages -ne "edit") -and ($addpackages -ne "transfer")){
[array]$newsoftware += $collectionlist|? line -eq $addpackages
}
} until ($addpackages -eq "done")


#Added packages will get processed after DONE has been entered
if ($newsoftware){
foreach ($c in $newsoftware){
$ID = $c.collectionID
$Collection = gwmi -class SMS_Collection -namespace $namespace -computername $SCCMserver -credential $admcred|? CollectionID -eq $ID
$ruleclass = gwmi -namespace $namespace -class "SMS_CollectionRuleDirect" -computername $SCCMserver -list -credential $admcred
$AddComputer = gwmi -ComputerName $SCCMServer -Namespace $Namespace -Class "SMS_R_System" -Filter "Name = '$($computername)'" -credential $admcred
$NewRule = $RuleClass.CreateInstance()     
$NewRule.RuleName = $($AddComputer.name)
$NewRule.ResourceClassName = "SMS_R_System" 
$NewRule.ResourceID = $($AddComputer.resourceid)
$Collection.AddMembershipRules($newrule)
$Collection.requestrefresh()
$CheckApps = Get-WmiObject -Namespace $namespace -Class SMS_fullcollectionmembership -ComputerName $SCCMServer -filter "Name = '$computername'" -credential $admcred
$InstalledApps = $CollectionList|? {$CheckApps.collectionID -contains $_.collectionID}
$AddedApps = $Installedapps|? {$InstalledSoftwareList.collectionID -notcontains $_.collectionID}
[array]$apps = $Addedapps.name
write-host ("This software has been added to $Computername successfully: ")
($Installedapps|? {$InstalledSoftwareList.collectionID -notcontains $_.collectionID}).name
}
}

Friday, June 10, 2016

PowerShell & SCCM 2012: Portable Script for Removing Computers from Collections

While in the field away from your SCCM Console, you can still remove collections from a computer via this script. Run as a user with SCCM rights or input your own $admcred and add -credential $admcred to each SCCM WMI call.

Here's an example of removing collection 4:
$ComputerName = read-host "Enter Computer Name"
$SCCMserver = "SCCMServer01"
$namespace = "root\sms\site_xx1"
$i = 0

#SCCM
#Getting list of current software collections and then filtering out unneeded selection items
if (test-connection $SCCMServer){
$xlist = import-csv \\server\share\offlist.csv #list of collection exclusions
$xlist|add-member -notepropertyname line -notepropertyvalue ""
$CollectionList = get-wmiobject -query "Select * from SMS_Collection" -namespace $namespace -computername $SCCMserver
$CollectionList = $CollectionList|? {$xlist.name -notcontains $_.name}
foreach ($C in $CollectionList){$i++;$C|add-member -notepropertyname line -notepropertyvalue $i}
}

$CurrentApps = Get-WmiObject -Namespace $namespace -Class SMS_fullcollectionmembership -ComputerName $SCCMServer -filter "Name = '$computername'"
$InstalledSoftwareList = $CollectionList|? {$CurrentApps.collectionID -contains $_.collectionID}

do{
write-host "SCCM Software already installed on $computername" -f white
$InstalledSoftwareList|format-table line,name -hidetableheaders
if ($removesoftware){
write-host "Software to be removed" -f yellow
$removesoftware|format-table line,name -hidetableheaders

}
write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to remove SCCM software from $computername"
write-host "Enter " -nonewline;write-host "DONE" -f white -nonewline;write-host " if satisfied with removal list"
$removepackages = read-host "(Line number or Done)"
if ($removepackages -ne "done"){
[array]$removesoftware += $collectionlist|? line -eq $removepackages
}
} while ($removepackages -ne "done")

Creates the menu:
Enter Computer Name: PCReception01
SCCM Software already installed on PCReception01

  1 Adobe Acrobat Standard DC
  2 7 Zip
  3 Google Earth Pro
  4 Microsoft Office 2013
  5 Windows Mobile Device Center

Enter line number to remove SCCM software from PCReception01 
Enter DONE if satisfied with removal list
(Line number or DONE): 4

SCCM Software already installed on PCReception01

  1 Adobe Acrobat Standard DC
  2 7 Zip
  3 Google Earth Pro
  5 Windows Mobile Device Center

Software to be removed

4 Microsoft Office 2013

Enter line number to remove SCCM software from PCReception01 
Enter DONE if satisfied with removal list
(Line number or DONE): 

And now we remove each selected collection via the $removesoftware variable:
foreach ($r in $removesoftware){
$ID = $r.collectionID
$Collection = get-wmiobject -class SMS_Collection -namespace $namespace -computername $SCCMserver|? CollectionID -eq $ID
$ruleclass = get-wmiobject -namespace $namespace -class "SMS_CollectionRuleDirect" -computername $SCCMserver -list
$RemoveComputer = get-wmiobject -ComputerName $SCCMServer -Namespace $Namespace -Class "SMS_R_System" -Filter "Name = '$($computername)'"
$DelRule = $RuleClass.CreateInstance()     
$DelRule.RuleName = $($RemoveComputer.name)
$DelRule.ResourceClassName = "SMS_R_System" 
$DelRule.ResourceID = $($RemoveComputer.resourceid)
$Collection.DeleteMemberShipRule($DelRule)
$Collection.requestrefresh()
}

Here's what you should see:
___GENUS               : 2
___CLASS               : ___PARAMETERS
___SUPERCLASS          :
___DYNASTY             : ___PARAMETERS
___RELPATH             :
___PROPERTY_COUNT      : 1
___DERIVATION          : {}
___SERVER              :
___NAMESPACE           :
___PATH                :
ReturnValue            : 0
PSComputerName         :

___GENUS               : 2
___CLASS               : ___PARAMETERS
___SUPERCLASS          :
___DYNASTY             : ___PARAMETERS
___RELPATH             :
___PROPERTY_COUNT      : 1
___DERIVATION          : {}
___SERVER              :
___NAMESPACE           :
___PATH                :
ReturnValue            : 0
PSComputerName         :

You want to see ReturnValue's of 0. Anything else and the removal wasn't successful.

PowerShell & SCCM 2012: Portable Script for Adding Computers to Collections

Being a field technician, the SCCM Console is not always nearby. The script in this post works from a thumb drive and has no need for the SCCM PowerShell module. Run this script with SCCM level credentials or you can add your username/password ($admcred) and add -credential $admcred to your SCCM WMI calls.


$SCCMserver = "SCCMServer01"
$namespace = "root\sms\site_xx1"
$computername = read-host "Enter Computer Name"
$i = 0

#SCCM
#Getting list of current software collections and then filtering out unneeded selection items
if (test-connection $SCCMServer){
$xlist = import-csv (\\server\share\offlist.csv #list of filtered out collections
$xlist|add-member -notepropertyname line -notepropertyvalue ""
$CollectionList = get-wmiobject -query "Select * from SMS_Collection" -namespace $namespace -computername $SCCMserver
$CollectionList = $CollectionList|? {$xlist.name -notcontains $_.name}
foreach ($C in $CollectionList){$i++;$C|add-member -notepropertyname line -notepropertyvalue $i} #adding line numbers to each collection entry
}else{write-host "No SCCM Server connection, ending script" -f yellow;start-sleep 10;exit}

$CurrentApps = Get-WmiObject -Namespace $namespace -Class SMS_fullcollectionmembership -ComputerName $SCCMServer -filter "Name = '$computername'"
$InstalledSoftwareList = $CollectionList|? {$CurrentApps.collectionID -contains $_.collectionID}

do{
cls
write-host "Available SCCM Software Packages" -f white
$collectionlist|? {$InstalledSoftwareList.name -notcontains $_.name}|format-table line,name
write-host "SCCM Software already installed on $computername" -f white
$InstalledSoftwareList|format-table line,name -hidetableheaders
if ($newsoftware){
write-host "Software to be added" -f yellow
$newsoftware|format-table line,name -hidetableheaders
}
write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to add SCCM software to $computername"
write-host "Enter " -nonewline;write-host "DONE" -f white -nonewline;write-host " if satisfied with install list"
$addpackages = read-host "(Line number or Done)"
if ($addpackages -ne "done"){
$newsoftware += $collectionlist|? line -eq $addpackages
}
} while ($addpackages -ne "done")

Here's a sample of this menu after selecting line item 7 and typing DONE at the prompt:
Available SCCM Software Packages

line name
---- ----
   1 Adobe Acrobat Pro DC
   3 Adobe Acrobat Standard DC
   4 Base Camp
   5 Google Earth Pro

SCCM Software already installed on PCReception01

   2 Adobe Acrobat Reader DC
   6 7 Zip

Software to be added

7 Windows Mobile Device Center

Enter line number to add SCCM software to PCReception01
Enter DONE if satisfied with installation list
(Line number or DONE): DONE

Now we add $computername to the selected collection via the $newsoftware variable. Let's create a new rule that adds the computer it to the collection:
foreach ($c in $newsoftware){
$ID = $c.collectionID
$Collection = get-wmiobject -class SMS_Collection -namespace $namespace -computername $SCCMserver|? CollectionID -eq $ID
$ruleclass = get-wmiobject -namespace $namespace -class "SMS_CollectionRuleDirect" -computername $SCCMserver -list
$AddComputer = get-wmiobject -ComputerName $SCCMServer -Namespace $Namespace -Class "SMS_R_System" -Filter "Name = '$($computername)'"
$NewRule = $RuleClass.CreateInstance()     
$NewRule.RuleName = $($AddComputer.name)
$NewRule.ResourceClassName = "SMS_R_System" 
$NewRule.ResourceID = $($AddComputer.resourceid)
$Collection.AddMembershipRules($newrule)
$Collection.requestrefresh()
}

And here's how that looks:
___GENUS               : 2
___CLASS               : ___PARAMETERS
___SUPERCLASS          :
___DYNASTY             : ___PARAMETERS
___RELPATH             :
___PROPERTY_COUNT      : 2
___DERIVATION          : {}
___SERVER              :
___NAMESPACE           :
___PATH                :
QueryIDs               : {0}
ReturnValue            : 0
PSComputerName         :

___GENUS               : 2
___CLASS               : ___PARAMETERS
___SUPERCLASS          :
___DYNASTY             : ___PARAMETERS
___RELPATH             :
___PROPERTY_COUNT      : 1
___DERIVATION          : {}
___SERVER              :
___NAMESPACE           :
___PATH                :
ReturnValue            : 0
PSComputerName         :


You want the returnvalue to equal 0.  This means the rule successfully added your computer to the collection.

Sunday, May 22, 2016

PowerShell & SCCM 2012: Get Old Computer SCCM Software Packages, add more software, and Export CSV out for New Computer

Using PowerShell and WMI to access the SCCM server, this post shows how to transfer a software list from the old computer and export it for the new one. In another post I describe how to automate the new computers software package collection addition process after its registered itself with the SCCM server and installed the SCCM client software.

$SCCMserver = SCCMServer01
$namespace = "root\sms\site_xx1"
$adminname = "Domain\AdmUser"
$password = get-content .\adminpassword.txt|convertto-securestring -key (1..16)
$admcred = new-object system.management.automation.pscredential($adminname,$password)
$i = 0

$OldComputerSoftware = Get-WmiObject -Namespace $namespace -Class SMS_fullcollectionmembership -ComputerName $SCCMServer -filter "Name = '$SCCMoldcomputer'" -credential $admcred
$OldComputerCollectionMemberList = $CollectionList|? {$OldComputerSoftware.collectionID -contains $_.collectionID}

Above I declare my variables, query the SCCM server for all the software on the old computer, and compare it to the $CollectionList collections filtering array. Next I create $NewPCSoftwareList using the old computer software list. Add line numbers and filter unwanted collections via $XList. The $AddedSoftware variable displays the existing software from the old computer and will be updated with software selections in the read-host menu below:

$NewPCSoftwareList = $OldComputerCollectionMemberList|select Name,CollectionID
foreach ($C in $NewPCSoftwareList){$i++;$C|add-member -notepropertyname line -notepropertyvalue $i}
$NewPCSoftwareList = $NewPCSoftwareList|? {$xlist.name -notcontains $_.name}
$addedsoftware = $collectionlist|? {$NewPCSoftwareList.name -contains $_.name}


Available SCCM Software Packages
 1 Adobe Acrobat Pro
 2 Adobe Acrobat Standard
 3 Base Camp
 5 Topography Software
 6 Google Earth Pro
 7 Windows Mobile Device Center

OldComputerName SCCM Software will be installed on NewComputerName 

 4 7-Zip
 8 Microsoft Office 2013

Enter line number to add SCCM software to NewComputerName
Enter DONE if satisfied with install list
(Line number or Done): _


do{
cls
write-host "Available SCCM Software Packages" -f white
$collectionlist|? {$InstalledSoftwareList.name -notcontains $_.name}|format-table line,name
write-host "SCCM Software already installed on $computername" -f white
$InstalledSoftwareList|format-table line,name -hidetableheaders
if ($newsoftware){
write-host "Software to be added" -f yellow
$newsoftware|format-table line,name -hidetableheaders

}
write-host "Enter " -nonewline;write-host "line number" -f white -nonewline;write-host " to add SCCM software to $computername"
write-host "Enter " -nonewline;write-host "DONE" -f white -nonewline;write-host " if satisfied with install list"
$addpackages = read-host "(Line number or Done)"
if ($addpackages -ne "done"){
$newsoftware += $collectionlist|? line -eq $addpackages
}
} while ($addpackages -ne "done")
The starting menu displays the full available software list minus those software already pre-selected to be added to the new computer. I input the number for each additional software I want added to the new computer then type DONE when finished adding software. Note that the line numbers disappear from the top list when selected on the bottom one. After DONE is typed, the $addedsoftware array gets exported to a CSV that the new computer will access in order to install that software. That part of the process will be in another post.

if ($addedsoftware){$addedsoftware|export-csv .\NewComputerName-SCCMsoftware.csv}