Skip to content

Instantly share code, notes, and snippets.

@brianfgonzalez
Last active September 15, 2023 18:50
Show Gist options
  • Save brianfgonzalez/b0976f889bd3b46722dca3b5dcfeb68d to your computer and use it in GitHub Desktop.
Save brianfgonzalez/b0976f889bd3b46722dca3b5dcfeb68d to your computer and use it in GitHub Desktop.
attempts to repair a pkg in contentlib using pkg files from working/VALID content lib.
$workingContentLib = '\\bg--ps1site\SCCMContentLib$'
$nonWorkingContentLib = '\\bg--ps1dpmp2.bg-lab.com\SCCMContentLib$'
$packageId = 'CS100004'
$strings = [System.Collections.Generic.HashSet[string]]::new()
get-childitem ('{0}\datalib\{1}*' -f $workingContentLib, $packageId) -Filter "*.ini" |
Get-Content |
ForEach-Object {
$_ -Match 'Hash=(.{4})' | Out-Null
$strings.Add($Matches[1]) | Out-Null
}
$strings #this is a set containing all filelib\<folderNames> we care about
foreach ($string in $strings) {
write-host ('cmdline: C:\Windows\system32\Robocopy.exe /mir "{0}\filelib\{1}" "{2}\filelib\{1}"' -f $workingContentLib,$string,$nonWorkingContentLib)
#saps -FilePath C:\Windows\system32\Robocopy.exe -ArgumentList ('/mir "{0}\filelib\{1}" "{2}\filelib\{1}"' -f $workingContentLib,$string,$nonWorkingContentLib)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment