Newbee need help

hi,

I will use this code with powershell:

Remove-Item -Path “C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service*” -Verbose

my problem is, it needs an answer as Keystroke: “J”

I found some things:

#Wscript objekt
$wshell = New-Object -com “Wscript.Shell”

Defender

Remove-Item -Path “C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service*” -Verbose

wait

Start-Sleep 5

send J for yes

$wshell.sendkeys(“J”)

It seems not to run corrct can someone help me? thanks a lot

Jumbano21,
Welcome back to the forum. :wave:t3: Long time no see.

Did you try the parameter -Force?

hi, yes true :wink:

you mean:

Remove-Item -Path “C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service*” -Verbose -Force

Yes.

And please … when you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org 1 <---- Click :point_up_2:t4: :wink:

(sometimes the button hides behind the settings gear symbol :wink: )