Functions/Data/Export-CabFiles.ps1
function Export-CabFiles { [cmdletbinding()] Param ( # Path to Cab File [Parameter(Mandatory=$true)] [string] $CabPath, # Path to Destination [Parameter(Mandatory=$true)] [string] $Destination, # Target Specific Items By Name [Parameter(Mandatory=$false)] [string[]] $TargetItems ) process { # Open Shell Application $Shell = New-Object -Comobject "Shell.Application" # Parse Cab Archive and Select Item Scope $SourceCab = if($TargetItems) {$Shell.Namespace($CabPath).items() | where name -in $TargetItems} else {$Shell.Namespace($CabPath).items()} # Specify output point for Shell Application $DestinationFolder = $Shell.Namespace($Destination) # Extract Files $DestinationFolder.CopyHere($SourceCab) } } |