Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Spacewolf
May 19, 2014
OK, so. First time posting in SH/SC in a long time, didn't see any suggested posting format in the rules.

Here's the system: A Windows 8.1 system, with Windows Defender as my virus scan of choice (and also employer mandate for my work-from-home job so it works out that way).

Running a full scan on my system takes 2-3 hours to complete, therefore I would like to start it when I go to bed (IE, upon user trigger at whatever point in time) once a week. At the completion of the scan, I would like the system to shut down without action from the user (as the user will be asleep, hopefully).

I see no obvious way to do this in Windows Defender, and getting another virus scan program is neither desired by me nor even allowed by my employer. So how do I do this? Ideally, this would be a batch file or something I could place on the desktop and click when I want it to execute, but if it's slightly more complicated I won't complain, personally.

Adbot
ADBOT LOVES YOU

Thanks Ants
May 21, 2004

#essereFerrari


Does Defender put anything into the event log when a scan completes?

redeyes
Sep 14, 2002

by Fluffdaddy
Serious question, has it ever caught anything on your system?

feedmegin
Jul 30, 2008

redeyes posted:

Serious question, has it ever caught anything on your system?

If it's mandated by his employer then that hardly matters tbf

Spacewolf
May 19, 2014

feedmegin posted:

If it's mandated by his employer then that hardly matters tbf

Precisely, feedmegin. It hasn't (then again neither have other virus scanners I've used), but that isn't relevant.

Thanks Ants posted:

Does Defender put anything into the event log when a scan completes?

I find that, in the log, event 1001 from Windows Defender tells me when a scan of any sort completes, but it doesn't distinguish between a quick scan and a full scan. So that is not useful, I would think?

Mr. Clark2
Sep 17, 2003

Rocco sez: Oh man, what a bummer. Woof.

I've never used windows defender on Windows 8.1 so I can't say for sure how accurate this is but you should be able to set a schedule for your full scan. See here: https://support.microsoft.com/en-us/help/4026132/windows-10-schedule-a-scan-in-windows-defender-antivirus . Once you've done that, you can just make a scheduled task that runs on the schedule of your choosing and shuts down the PC.
Is this your personally owned PC or one your employer has issued you? What is your employer using to monitor compliance with their policies?

BangersInMyKnickers
Nov 3, 2004

I have a thing for courageous dongles

Do it in a batch script:

code:
C:\Program Files\Windows Defender>MpCmdRun.exe /scan /scantype 2
shutdown /s /f
MpCmdRun won't close out until the scan completes.

Spacewolf
May 19, 2014

Mr. Clark2 posted:

I've never used windows defender on Windows 8.1 so I can't say for sure how accurate this is but you should be able to set a schedule for your full scan. See here: https://support.microsoft.com/en-us/help/4026132/windows-10-schedule-a-scan-in-windows-defender-antivirus . Once you've done that, you can just make a scheduled task that runs on the schedule of your choosing and shuts down the PC.
Is this your personally owned PC or one your employer has issued you? What is your employer using to monitor compliance with their policies?

Personal, employer's software has to see a full scan completed once every so many days (among other precautions) or it won't run.

BangersInMyKnickers posted:

Do it in a batch script:

code:
C:\Program Files\Windows Defender>MpCmdRun.exe /scan /scantype 2
shutdown /s /f
MpCmdRun won't close out until the scan completes.

Awesome. Just so I'm clear, what do the switches on shutdown do?

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD
code:
shutdown /?
Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /sg        Shutdown the computer. On the next boot,
               restart any registered applications.
    /r         Full shutdown and restart the computer.
    /g         Full shutdown and restart the computer. After the system is
               rebooted, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
               Combine with /fw to clear any pending boots to firmware.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /hybrid    Performs a shutdown of the computer and prepares it for fast startup.
               Must be used with /s option.
    /fw        Combine with a shutdown option to cause the next boot to go to the
               firmware user interface.
    /e         Document the reason for an unexpected shutdown of a computer.
    /o         Go to the advanced boot options menu and restart the computer.
               Must be used with /r option.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.

Spacewolf
May 19, 2014
~Coxy, thank you so very much.

I shall set up the batch file this evening (hopefully I remember how to do it properly, been literally decades since I had to) and tell how it goes.

Mr. Clark2
Sep 17, 2003

Rocco sez: Oh man, what a bummer. Woof.

Spacewolf posted:

~Coxy, thank you so very much.

I shall set up the batch file this evening (hopefully I remember how to do it properly, been literally decades since I had to) and tell how it goes.

Copy/paste the above lines into notepad and save as blah.bat (choose a name to your liking). Create scheduled task that runs blah.bat on schedule of your choosing or run it manually by double clicking it whenever you want.

Spacewolf
May 19, 2014
Yup. I test the batch file in 15 minutes. Here goes nothin.

Spacewolf
May 19, 2014
So, copy pasted ~Coxy's lines into a batch file, named it scanandshutdown.bat.

Ran it last night. It shut down the computer, but did not start a scan. Created MPCmdRun.exe as a file on the desktop, a file which clicking on on its own reveals it does not work with my version of windows. (8.1)

I am now confused and saddened. This is simple, right? I'm missing something obvious, I hope....

BangersInMyKnickers
Nov 3, 2004

I have a thing for courageous dongles

"C:\Program Files\Windows Defender\MpCmdRun.exe" /scan /scantype 2

Make the first line look like that. I was copying output from my console; you won't be in that Window Defender directory by default so the path needs to be explicitly stated.

Spacewolf
May 19, 2014

BangersInMyKnickers posted:

"C:\Program Files\Windows Defender\MpCmdRun.exe" /scan /scantype 2

Make the first line look like that. I was copying output from my console; you won't be in that Window Defender directory by default so the path needs to be explicitly stated.

Ahhhh. Okay. I am learning, slowly but surely. I thought I already knew, but guess not!

Spacewolf
May 19, 2014
This is what scanandshutdown.bat looks like now:

code:
"C:\Program Files\Windows Defender>MpCmdRun.exe" /scan /scantype 2
shutdown /s /f
Problem is, it's going straight to the shutdown as before, and skipping the scan. Aieee.

Adbot
ADBOT LOVES YOU

Spacewolf
May 19, 2014

Spacewolf posted:

This is what scanandshutdown.bat looks like now:

code:
"C:\Program Files\Windows Defender>MpCmdRun.exe" /scan /scantype 2
shutdown /s /f
Problem is, it's going straight to the shutdown as before, and skipping the scan. Aieee.

And I just realized my typo. At what point do I get forced to wear a dunce cap?

Upon correcting the typo, the file works as advertised.

  • Locked thread