I have two scripts namely, Add and Report. I am having a array of items in Add script. I want to read this array in Report script. Add script can be called multiple times. I want to retain the value in array and read them in Report script. I have added Persistent Session ID to both these scripts. How do I update the array list in Add script whenever the add script is called and read the array list in Report script. I have a global function where I have initialized the class,
class Modes {
[string]$ItemId
[string]$InstallMode
[string]$MergeMode
}
[Modes[]]$itemModes = @()
In Add.script,
foreach($item in $selectedItems){
$itemMode= [Modes]@{
ItemId = (Get-Item $item).Name
InstallMode= $installModeOption
MergeMode = $mergeModeOption
}
$itemModes =[Array] $itemModes + $itemMode
}
In Report.script
$itemModes|Show-ListView
How do I read the itemsModes I have added in Add.script in Report.script?