Event ID 2013 (Disk Is At Or Near Capacity) not getting loggedHow can i create a low disk space alert on Windows Server 2012 R2 DatacenterDPM 2010 “Disk failed or disk not found”Server 2008 Disk Management HangsWin 2008 R2 - copying TO disk is very slow, copying FROM is more or less okayHyperV Cluster using IBM X3650 M3 and DS3400 SANWindows 2008 R2 winsxs folder - growth increasesDisk IO cutting out on Windows Server 2008 R2 running in VMWareRemote desktop hangs & disconnectsEvents not visible in Event Log viewerEvent 4740 not being logged on a domain serverConstant 0xc000012d Errors and program crashes
Shorten or merge multiple lines of `&> /dev/null &`
Testing using real data of the customer
Why did it take so long for Germany to allow electric scooters / e-rollers on the roads?
How to let other coworkers know that I don't share my coworker's political views?
What were the Ethiopians doing in Xerxes' army?
Why was this character made Grand Maester?
What is the intuition behind the term Transitive for verbs?
How to melt snow without fire or using body heat?
Should I split timestamp parts into separate columns?
How would a developer who mostly fixed bugs for years at a company call out their contributions in their CV?
Can “du tout” be used positively?
shell script is not executed after adding it as a crontab job
What is the use case for non-breathable waterproof pants?
On San Andreas Speedruns, why do players blow up the Picador in the mission Ryder?
Best shape for a necromancer's undead minions for battle?
Why is 'additive' EQ more difficult to use than 'subtractive'?
Is superuser the same as root?
Why does splatting create a tuple on the rhs but a list on the lhs?
Is "vegetable base" a common term in English?
Storing voxels for a voxel Engine in C++
What did the 'turbo' button actually do?
Is keeping the forking link on a true fork necessary (Github/GPL)?
3 prong range outlet
Removing the last element of a list
Event ID 2013 (Disk Is At Or Near Capacity) not getting logged
How can i create a low disk space alert on Windows Server 2012 R2 DatacenterDPM 2010 “Disk failed or disk not found”Server 2008 Disk Management HangsWin 2008 R2 - copying TO disk is very slow, copying FROM is more or less okayHyperV Cluster using IBM X3650 M3 and DS3400 SANWindows 2008 R2 winsxs folder - growth increasesDisk IO cutting out on Windows Server 2008 R2 running in VMWareRemote desktop hangs & disconnectsEvents not visible in Event Log viewerEvent 4740 not being logged on a domain serverConstant 0xc000012d Errors and program crashes
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to set up alerts for low disk space conditions on a server (Windows Server 2008 R2 Enterprise, SP1). To do this I want to trigger an email via Task Scheduler whenever Event ID 2013 is logged in the System event log.
The problem is that Event ID 2013 doesn't seem to be occurring. The LowDiskSpaceMinimum and DiskSpaceThreshold registry keys are not present, which to my understanding should mean that Event 2013 occurs when the disk space of any partition drops below 10 percent.
I've tried to trigger this event on three servers now, on system drives (C:) or data drives (E:).
I have three theories:
- The default threshold on 2008 R2 is much lower than 10% (but it must be VERY low given how full I'm making these drives in my tests)
- The system only checks the disk space infrequently, and I'm just not waiting long enough
- Something else is preventing this event from being logged that I haven't considered
If anybody can give me any suggestions I'd be grateful.
windows-server-2008-r2 windows-event-log
add a comment |
I'm trying to set up alerts for low disk space conditions on a server (Windows Server 2008 R2 Enterprise, SP1). To do this I want to trigger an email via Task Scheduler whenever Event ID 2013 is logged in the System event log.
The problem is that Event ID 2013 doesn't seem to be occurring. The LowDiskSpaceMinimum and DiskSpaceThreshold registry keys are not present, which to my understanding should mean that Event 2013 occurs when the disk space of any partition drops below 10 percent.
I've tried to trigger this event on three servers now, on system drives (C:) or data drives (E:).
I have three theories:
- The default threshold on 2008 R2 is much lower than 10% (but it must be VERY low given how full I'm making these drives in my tests)
- The system only checks the disk space infrequently, and I'm just not waiting long enough
- Something else is preventing this event from being logged that I haven't considered
If anybody can give me any suggestions I'd be grateful.
windows-server-2008-r2 windows-event-log
add a comment |
I'm trying to set up alerts for low disk space conditions on a server (Windows Server 2008 R2 Enterprise, SP1). To do this I want to trigger an email via Task Scheduler whenever Event ID 2013 is logged in the System event log.
The problem is that Event ID 2013 doesn't seem to be occurring. The LowDiskSpaceMinimum and DiskSpaceThreshold registry keys are not present, which to my understanding should mean that Event 2013 occurs when the disk space of any partition drops below 10 percent.
I've tried to trigger this event on three servers now, on system drives (C:) or data drives (E:).
I have three theories:
- The default threshold on 2008 R2 is much lower than 10% (but it must be VERY low given how full I'm making these drives in my tests)
- The system only checks the disk space infrequently, and I'm just not waiting long enough
- Something else is preventing this event from being logged that I haven't considered
If anybody can give me any suggestions I'd be grateful.
windows-server-2008-r2 windows-event-log
I'm trying to set up alerts for low disk space conditions on a server (Windows Server 2008 R2 Enterprise, SP1). To do this I want to trigger an email via Task Scheduler whenever Event ID 2013 is logged in the System event log.
The problem is that Event ID 2013 doesn't seem to be occurring. The LowDiskSpaceMinimum and DiskSpaceThreshold registry keys are not present, which to my understanding should mean that Event 2013 occurs when the disk space of any partition drops below 10 percent.
I've tried to trigger this event on three servers now, on system drives (C:) or data drives (E:).
I have three theories:
- The default threshold on 2008 R2 is much lower than 10% (but it must be VERY low given how full I'm making these drives in my tests)
- The system only checks the disk space infrequently, and I'm just not waiting long enough
- Something else is preventing this event from being logged that I haven't considered
If anybody can give me any suggestions I'd be grateful.
windows-server-2008-r2 windows-event-log
windows-server-2008-r2 windows-event-log
asked Feb 4 '13 at 16:36
paulHpaulH
1332314
1332314
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I eventually got this working. I had to specifically add the LowDiskSpaceMinimum and DiskSpaceThreshold registry keys and then it started to work.
I do agree that installing server monitoring software is probably a better way to go in a lot of cases, and if I was a sysadmin then I would do exactly that and centralise it to monitor all our servers. But my concern is only for one system so this approach works well enough for my needs (and means I don't need to wait for the sysadmins to actually do something!!)
If anybody else wants to set up something similar then here are the registry settings (DiskSpaceThreshold set to 10%):
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanServerParameters]
"DiskSpaceThreshold"=dword:0000000a
"LowDiskSpaceMinimum"=dword:00000000
And here is the Task Scheduler job, which can be saved as an xml file and imported. Just change [ServerName], [YourDomain], [YourUserName] and the email addresses:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-02-05T14:37:17.165247</Date>
<Author>[YourDomain][YourUserName]</Author>
<Description>Send an emailed warning when a low disk space event is recorded.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='srv'] and EventID=2013]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-20</UserId>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<SendEmail>
<Server>smtpServer.YourCompany.co.uk</Server>
<Subject>Low disk space warning on server: [ServerName]</Subject>
<To>Admin@YourCompany.co.uk</To>
<From>noreply@YourCompany.co.uk</From>
<Body>Disk space is running low on server: [ServerName] - please investigate.</Body>
<HeaderFields />
<Attachments />
</SendEmail>
</Actions>
</Task>
The Registry entries you provided there are not valid.a = 10??
– transilvlad
Nov 28 '13 at 16:55
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
1
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
1
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
|
show 2 more comments
I have used paulH's approach in the past with success. However today I ran into a problem on a Windows 2016 Server: when saving the task I got an error stating that email is deprecated feature and Windows won't let you save the new task.
In order to make this work I found another approach on https://www.netwoven.com/2017/04/28/send-an-e-mail-windows-server-2012-task-scheduler-deprecated-feature-solved/ which uses Powershell as below:
Create a Powershell script as below and save it as smtpscript.ps1 to a known folder such as C:UsersPublicDocuments
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mail.yourserver.com"
$SmtpClient.Port = 587
$SmtpClient.Credentials = New-Object System.Net.NetworkCredential( "user@yourserver.com", "pw" );
$mailmessage.from = ("dnr@yourserver.com")
$mailmessage.To.add("you@yourserver.com")
$mailmessage.Subject = “An appropriate subject”
$mailmessage.Body = “An appropriate message body.”
$smtpclient.Send($mailmessage)
Save that script then create your task as above but under the Action tab use Start a program and enter these details:
Program/script: powershell.exe
Add Arguments (optional): C:UsersPublicDocumentssmtpscript.ps1
Save the task and you have an email alert.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f475256%2fevent-id-2013-disk-is-at-or-near-capacity-not-getting-logged%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I eventually got this working. I had to specifically add the LowDiskSpaceMinimum and DiskSpaceThreshold registry keys and then it started to work.
I do agree that installing server monitoring software is probably a better way to go in a lot of cases, and if I was a sysadmin then I would do exactly that and centralise it to monitor all our servers. But my concern is only for one system so this approach works well enough for my needs (and means I don't need to wait for the sysadmins to actually do something!!)
If anybody else wants to set up something similar then here are the registry settings (DiskSpaceThreshold set to 10%):
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanServerParameters]
"DiskSpaceThreshold"=dword:0000000a
"LowDiskSpaceMinimum"=dword:00000000
And here is the Task Scheduler job, which can be saved as an xml file and imported. Just change [ServerName], [YourDomain], [YourUserName] and the email addresses:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-02-05T14:37:17.165247</Date>
<Author>[YourDomain][YourUserName]</Author>
<Description>Send an emailed warning when a low disk space event is recorded.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='srv'] and EventID=2013]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-20</UserId>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<SendEmail>
<Server>smtpServer.YourCompany.co.uk</Server>
<Subject>Low disk space warning on server: [ServerName]</Subject>
<To>Admin@YourCompany.co.uk</To>
<From>noreply@YourCompany.co.uk</From>
<Body>Disk space is running low on server: [ServerName] - please investigate.</Body>
<HeaderFields />
<Attachments />
</SendEmail>
</Actions>
</Task>
The Registry entries you provided there are not valid.a = 10??
– transilvlad
Nov 28 '13 at 16:55
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
1
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
1
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
|
show 2 more comments
I eventually got this working. I had to specifically add the LowDiskSpaceMinimum and DiskSpaceThreshold registry keys and then it started to work.
I do agree that installing server monitoring software is probably a better way to go in a lot of cases, and if I was a sysadmin then I would do exactly that and centralise it to monitor all our servers. But my concern is only for one system so this approach works well enough for my needs (and means I don't need to wait for the sysadmins to actually do something!!)
If anybody else wants to set up something similar then here are the registry settings (DiskSpaceThreshold set to 10%):
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanServerParameters]
"DiskSpaceThreshold"=dword:0000000a
"LowDiskSpaceMinimum"=dword:00000000
And here is the Task Scheduler job, which can be saved as an xml file and imported. Just change [ServerName], [YourDomain], [YourUserName] and the email addresses:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-02-05T14:37:17.165247</Date>
<Author>[YourDomain][YourUserName]</Author>
<Description>Send an emailed warning when a low disk space event is recorded.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='srv'] and EventID=2013]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-20</UserId>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<SendEmail>
<Server>smtpServer.YourCompany.co.uk</Server>
<Subject>Low disk space warning on server: [ServerName]</Subject>
<To>Admin@YourCompany.co.uk</To>
<From>noreply@YourCompany.co.uk</From>
<Body>Disk space is running low on server: [ServerName] - please investigate.</Body>
<HeaderFields />
<Attachments />
</SendEmail>
</Actions>
</Task>
The Registry entries you provided there are not valid.a = 10??
– transilvlad
Nov 28 '13 at 16:55
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
1
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
1
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
|
show 2 more comments
I eventually got this working. I had to specifically add the LowDiskSpaceMinimum and DiskSpaceThreshold registry keys and then it started to work.
I do agree that installing server monitoring software is probably a better way to go in a lot of cases, and if I was a sysadmin then I would do exactly that and centralise it to monitor all our servers. But my concern is only for one system so this approach works well enough for my needs (and means I don't need to wait for the sysadmins to actually do something!!)
If anybody else wants to set up something similar then here are the registry settings (DiskSpaceThreshold set to 10%):
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanServerParameters]
"DiskSpaceThreshold"=dword:0000000a
"LowDiskSpaceMinimum"=dword:00000000
And here is the Task Scheduler job, which can be saved as an xml file and imported. Just change [ServerName], [YourDomain], [YourUserName] and the email addresses:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-02-05T14:37:17.165247</Date>
<Author>[YourDomain][YourUserName]</Author>
<Description>Send an emailed warning when a low disk space event is recorded.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='srv'] and EventID=2013]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-20</UserId>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<SendEmail>
<Server>smtpServer.YourCompany.co.uk</Server>
<Subject>Low disk space warning on server: [ServerName]</Subject>
<To>Admin@YourCompany.co.uk</To>
<From>noreply@YourCompany.co.uk</From>
<Body>Disk space is running low on server: [ServerName] - please investigate.</Body>
<HeaderFields />
<Attachments />
</SendEmail>
</Actions>
</Task>
I eventually got this working. I had to specifically add the LowDiskSpaceMinimum and DiskSpaceThreshold registry keys and then it started to work.
I do agree that installing server monitoring software is probably a better way to go in a lot of cases, and if I was a sysadmin then I would do exactly that and centralise it to monitor all our servers. But my concern is only for one system so this approach works well enough for my needs (and means I don't need to wait for the sysadmins to actually do something!!)
If anybody else wants to set up something similar then here are the registry settings (DiskSpaceThreshold set to 10%):
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanServerParameters]
"DiskSpaceThreshold"=dword:0000000a
"LowDiskSpaceMinimum"=dword:00000000
And here is the Task Scheduler job, which can be saved as an xml file and imported. Just change [ServerName], [YourDomain], [YourUserName] and the email addresses:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-02-05T14:37:17.165247</Date>
<Author>[YourDomain][YourUserName]</Author>
<Description>Send an emailed warning when a low disk space event is recorded.</Description>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='srv'] and EventID=2013]]</Select></Query></QueryList></Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-20</UserId>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<SendEmail>
<Server>smtpServer.YourCompany.co.uk</Server>
<Subject>Low disk space warning on server: [ServerName]</Subject>
<To>Admin@YourCompany.co.uk</To>
<From>noreply@YourCompany.co.uk</From>
<Body>Disk space is running low on server: [ServerName] - please investigate.</Body>
<HeaderFields />
<Attachments />
</SendEmail>
</Actions>
</Task>
answered Feb 14 '13 at 13:05
paulHpaulH
1332314
1332314
The Registry entries you provided there are not valid.a = 10??
– transilvlad
Nov 28 '13 at 16:55
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
1
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
1
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
|
show 2 more comments
The Registry entries you provided there are not valid.a = 10??
– transilvlad
Nov 28 '13 at 16:55
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
1
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
1
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
The Registry entries you provided there are not valid.
a = 10 ??– transilvlad
Nov 28 '13 at 16:55
The Registry entries you provided there are not valid.
a = 10 ??– transilvlad
Nov 28 '13 at 16:55
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used.
– paulH
Nov 28 '13 at 17:06
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX.
– transilvlad
Nov 28 '13 at 17:10
1
1
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all!
– paulH
Nov 28 '13 at 17:11
1
1
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
fwiw, 10 does equal a in hex. google.co.uk/#q=10+in+hex
– paulH
Nov 28 '13 at 17:28
|
show 2 more comments
I have used paulH's approach in the past with success. However today I ran into a problem on a Windows 2016 Server: when saving the task I got an error stating that email is deprecated feature and Windows won't let you save the new task.
In order to make this work I found another approach on https://www.netwoven.com/2017/04/28/send-an-e-mail-windows-server-2012-task-scheduler-deprecated-feature-solved/ which uses Powershell as below:
Create a Powershell script as below and save it as smtpscript.ps1 to a known folder such as C:UsersPublicDocuments
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mail.yourserver.com"
$SmtpClient.Port = 587
$SmtpClient.Credentials = New-Object System.Net.NetworkCredential( "user@yourserver.com", "pw" );
$mailmessage.from = ("dnr@yourserver.com")
$mailmessage.To.add("you@yourserver.com")
$mailmessage.Subject = “An appropriate subject”
$mailmessage.Body = “An appropriate message body.”
$smtpclient.Send($mailmessage)
Save that script then create your task as above but under the Action tab use Start a program and enter these details:
Program/script: powershell.exe
Add Arguments (optional): C:UsersPublicDocumentssmtpscript.ps1
Save the task and you have an email alert.
add a comment |
I have used paulH's approach in the past with success. However today I ran into a problem on a Windows 2016 Server: when saving the task I got an error stating that email is deprecated feature and Windows won't let you save the new task.
In order to make this work I found another approach on https://www.netwoven.com/2017/04/28/send-an-e-mail-windows-server-2012-task-scheduler-deprecated-feature-solved/ which uses Powershell as below:
Create a Powershell script as below and save it as smtpscript.ps1 to a known folder such as C:UsersPublicDocuments
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mail.yourserver.com"
$SmtpClient.Port = 587
$SmtpClient.Credentials = New-Object System.Net.NetworkCredential( "user@yourserver.com", "pw" );
$mailmessage.from = ("dnr@yourserver.com")
$mailmessage.To.add("you@yourserver.com")
$mailmessage.Subject = “An appropriate subject”
$mailmessage.Body = “An appropriate message body.”
$smtpclient.Send($mailmessage)
Save that script then create your task as above but under the Action tab use Start a program and enter these details:
Program/script: powershell.exe
Add Arguments (optional): C:UsersPublicDocumentssmtpscript.ps1
Save the task and you have an email alert.
add a comment |
I have used paulH's approach in the past with success. However today I ran into a problem on a Windows 2016 Server: when saving the task I got an error stating that email is deprecated feature and Windows won't let you save the new task.
In order to make this work I found another approach on https://www.netwoven.com/2017/04/28/send-an-e-mail-windows-server-2012-task-scheduler-deprecated-feature-solved/ which uses Powershell as below:
Create a Powershell script as below and save it as smtpscript.ps1 to a known folder such as C:UsersPublicDocuments
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mail.yourserver.com"
$SmtpClient.Port = 587
$SmtpClient.Credentials = New-Object System.Net.NetworkCredential( "user@yourserver.com", "pw" );
$mailmessage.from = ("dnr@yourserver.com")
$mailmessage.To.add("you@yourserver.com")
$mailmessage.Subject = “An appropriate subject”
$mailmessage.Body = “An appropriate message body.”
$smtpclient.Send($mailmessage)
Save that script then create your task as above but under the Action tab use Start a program and enter these details:
Program/script: powershell.exe
Add Arguments (optional): C:UsersPublicDocumentssmtpscript.ps1
Save the task and you have an email alert.
I have used paulH's approach in the past with success. However today I ran into a problem on a Windows 2016 Server: when saving the task I got an error stating that email is deprecated feature and Windows won't let you save the new task.
In order to make this work I found another approach on https://www.netwoven.com/2017/04/28/send-an-e-mail-windows-server-2012-task-scheduler-deprecated-feature-solved/ which uses Powershell as below:
Create a Powershell script as below and save it as smtpscript.ps1 to a known folder such as C:UsersPublicDocuments
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mail.yourserver.com"
$SmtpClient.Port = 587
$SmtpClient.Credentials = New-Object System.Net.NetworkCredential( "user@yourserver.com", "pw" );
$mailmessage.from = ("dnr@yourserver.com")
$mailmessage.To.add("you@yourserver.com")
$mailmessage.Subject = “An appropriate subject”
$mailmessage.Body = “An appropriate message body.”
$smtpclient.Send($mailmessage)
Save that script then create your task as above but under the Action tab use Start a program and enter these details:
Program/script: powershell.exe
Add Arguments (optional): C:UsersPublicDocumentssmtpscript.ps1
Save the task and you have an email alert.
edited May 9 at 20:27
answered May 9 at 20:03
Jeff MerglerJeff Mergler
1055
1055
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f475256%2fevent-id-2013-disk-is-at-or-near-capacity-not-getting-logged%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown