Skip to content

Instantly share code, notes, and snippets.

@krisdb2009
Last active May 17, 2019 01:01
Show Gist options
  • Save krisdb2009/d63bff7388df17703cf9124affd0ef68 to your computer and use it in GitHub Desktop.
Save krisdb2009/d63bff7388df17703cf9124affd0ef68 to your computer and use it in GitHub Desktop.
Replaces all sub-folders in MDT Applications folder with a new SuperLTI.exe if a sub-folder contains SuperLTI.exe
$ChildDirectories = Get-ChildItem -Directory -Path "." #Gets all Applications Sub Folders
foreach($Directory in $ChildDirectories) { #Loops through each Applications Sub Folder
$Files = $Directory.GetFiles() #Gets all files within each Applications Sub Folder
foreach($File in $Files) { #Loops through each file within each Applications Sub Folder
if($File.Name -eq "SuperLTI.exe") { #If a sub directory within an Applications Sub Folder contains SuperLTI.exe
Copy-Item -Path "SuperLTI.exe" -Destination $Directory #Replace it with a copy at Applications root.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment