Systems or commands working with english datetime do not accept german date formats. Converting them directly to Datetime ist not possible. “System.DateTime”. Error: “String was not recognized as a valid DateTime.”
Example:
Solution:
Convert the date to an english datetime in case there are dots in it. German = 28.02.2017 , English 02/28/2017
$DateValue = "28.02.2017" # Play with this two values
$DateValue = "02/28/2017" # Play with this two values
if ($DateValue.contains("."))
{
$DateValue = [datetime]::parseexact($DateValue,"dd.MM.yyyy",$null)
Write-host "de"
}
Else
{
$DateValue = [datetime]$DateValue
Write-host "en"
}
$DateValue = "28.02.2017" # Play with this two values
$DateValue = "02/28/2017" # Play with this two values
if ($DateValue.contains("."))
{
$DateValue = [datetime]::parseexact($DateValue,"dd.MM.yyyy",$null)
Write-host "de"
}
Else
{
$DateValue = [datetime]$DateValue
Write-host "en"
}
I changed to a new Synology NAS from DSM 5.2 to 6.1. After migrating my WordPress site Permalinks worked only in default mode. On my old NAS i used to have something like “/2013/10/file-open-security-warning/” .
Problem:
The permalink update is not running after a change. So all posts ended up in 404 Errors.
Solution:
Changing the website server from Nginx to Apache within virtual host settings solved the Problem.
Some times agents start to stop collecting data without stopping completely . this is often when client are overloaded or management servers are for a while unavailable. In my case most times disk space counters stopped working as on of the first roles. So check this counter frequently, like every week or after maintenance jobs.
It can be easy done by using a query towards ops db.
First create a view
CREATE VIEW [dbo].[50beansDiskFreeSpace]
AS
SELECT TOP (10) PERCENT bme.Path, ps.PerfmonInstanceName, pdav.SampleValue, pdav.TimeSampled, dbo.MaintenanceMode.IsInMaintenanceMode
FROM dbo.PerformanceDataAllView AS pdav WITH (NOLOCK) INNER JOIN
dbo.PerformanceSource AS ps WITH (NOLOCK) ON pdav.PerformanceSourceInternalId = ps.PerformanceSourceInternalId INNER JOIN
dbo.Rules AS r WITH (NOLOCK) ON ps.RuleId = r.RuleId INNER JOIN
dbo.BaseManagedEntity AS bme WITH (NOLOCK) ON ps.BaseManagedEntityId = bme.BaseManagedEntityId INNER JOIN
dbo.MaintenanceMode ON bme.BaseManagedEntityId = dbo.MaintenanceMode.BaseManagedEntityId
WHERE (r.RuleName LIKE N'%LogicalDisk.FreeMB%' OR
r.RuleName = N'Microsoft.Windows.Server.ClusterDisksMonitoring.ClusterDisk.Monitoring.CollectPerfDataSource.FreeSpaceMB') AND (pdav.TimeSampled =
(SELECT MAX(TimeSampled) AS Expr1
FROM dbo.PerformanceDataAllView
WHERE (PerformanceSourceInternalId = pdav.PerformanceSourceInternalId)))
ORDER BY pdav.TimeSampled
GO
CREATE VIEW [dbo].[50beansDiskFreeSpace]
AS
SELECT TOP (10) PERCENT bme.Path, ps.PerfmonInstanceName, pdav.SampleValue, pdav.TimeSampled, dbo.MaintenanceMode.IsInMaintenanceMode
FROM dbo.PerformanceDataAllView AS pdav WITH (NOLOCK) INNER JOIN
dbo.PerformanceSource AS ps WITH (NOLOCK) ON pdav.PerformanceSourceInternalId = ps.PerformanceSourceInternalId INNER JOIN
dbo.Rules AS r WITH (NOLOCK) ON ps.RuleId = r.RuleId INNER JOIN
dbo.BaseManagedEntity AS bme WITH (NOLOCK) ON ps.BaseManagedEntityId = bme.BaseManagedEntityId INNER JOIN
dbo.MaintenanceMode ON bme.BaseManagedEntityId = dbo.MaintenanceMode.BaseManagedEntityId
WHERE (r.RuleName LIKE N'%LogicalDisk.FreeMB%' OR
r.RuleName = N'Microsoft.Windows.Server.ClusterDisksMonitoring.ClusterDisk.Monitoring.CollectPerfDataSource.FreeSpaceMB') AND (pdav.TimeSampled =
(SELECT MAX(TimeSampled) AS Expr1
FROM dbo.PerformanceDataAllView
WHERE (PerformanceSourceInternalId = pdav.PerformanceSourceInternalId)))
ORDER BY pdav.TimeSampled
GO
Now run the view . On top you will find all disks in Maintenance mode. It is clear they did not collect any data within the last few minutes . After that follow all servers with a partly disabled agent. on the bottom you will find clients having an TimeSampled within an few minutes. They are working well.
As powershell is running by default in secure mode , use the following setting to run powershell scripts from a scheduled task.
This way you do not have to elevate the rights for running scripts. Ensure your Powershell script is located in a folder where he is well protected from tempering bud accessible by the user the scheduled task is running under.