Background: I have a powershell script: script1 that accepts sourceDirectory and two destinations (name them dest1Directory and dest2Directory ).
SourceDirectory is structured as follows:
\ Source \ dest1 \ STUFF1
and
\ Source \ dest2 \ STUFF2
script1 calls another script: script2 , foreach STUFF (so script2 can be run 10 times, for example), providing script2 necessary destination parameter, which backs up all the contents of "STUFF", is replaced by dest1Directory and dest2Directory , and then copies all STUFF to the corresponding item destination.
script1 :
foreach ($folder in $STUFF1) { & $script2 -stuffParameter $folder -destDrive $dest1Directory -backUpDrive $BackUpDirectory }
The problem I am facing:
I call script1 from the visual studio website and would like script2 output all the backup directory paths that it creates, so I have links to them later. I tried this inside script2 :
$returnRollBackObj = New-Object Object Add-Member -memberType NoteProperty -name "RollBackLocation" -value $folderobj -inputObject $returnRollBackObj return $returnRollBackObj
But it does not seem to return objects, since they are calls in the subscript. I do not know how to return the undefined number of these objects from script1 so that I am at a loss. Can someone help me?
source share