i require help to create folder and extract selected file to the folder
please look into the script and please help to fix. and i’m trying create folder in the format like eg: report_09_10_2020
$7ZipPath = ‘“C:\Program Files\7-Zip\7z.exe”’
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
Filter = ‘Zip files (.zip)|.Zip|All files (.)|.’
Title = ‘Select the Zip file file’
}
$FileSelected = $FileBrowser.ShowDialog()
if ($FileSelected -ne ‘OK’)
{
Write-Host “File not selected” -ForegroundColor Red
return
}
else
{
$ZipFile = $FileBrowser.Filename
Write-Host “file $ZipFile”
}
$ZipFilePassword = Read-Host “Please enter the Password” -AsSecureString
$reportdate = read-host “Please enter report date (dd_mm_yyyy)”
$Destination = “Path\Report_$reportdate”
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ZipFilePassword)
$PlainTextPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$Command = “& $7ZipPath e -‘o$Destination’ -y -tzip -p$PlainTextPassword ‘$ZipFile’”
Invoke-Expression -Command $Command