'''$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
$Result = $Searcher.QueryHistory(0, $historyCount) | Select-Object Date,
@{name="Operation"; expression={switch($_.operation)
{
1 {"Installation"};
2 {"Uninstallation"};
3 {"Other"}
}}},
@{name="Status"; expression={switch($_.resultcode)
{
1 {"In Progress"};
2 {"Succeeded"};
3 {"Succeeded With Errors"};
4 {"Failed"};
5 {"Aborted"}
}}},
@{name="Update"; expression={IF($_.Title.tostring() -match "(.*?)"){$matches[0].replace('(','').replace(')','')}}},
Title $Result | Where{$_.Date -gt (Get-Date).AddDays(-14)} | Sort-Object Date | Select Date,Operation,Status,Update,Title | Export-Csv -NoType "$Env:userprofile\Desktop\WindowsUpdates.csv"| Format-Table
this is script save to notepad i want to get output using python
import subprocess
p = subprocess.run('F:\getwindowupdate.ps1', shell=True)
print(p.stdout)
this is only open the notepad file how to execute this powershell script using python