hi, can you please let me know does Dataminer script supports PowerShell scripts?
purpose: I am trying to schedule a task that can copy the logging folder weekly to NFS through scripts
$cDate = Get-Date -format yyyy-MM-dd
$NewPath = "\\192.168.10.10\AMS_DTH_A\testams\logs\$cDate"
New-Item -Path $NewPath -ItemType Directory
Copy-Item -Path "C:\Skyline DataMiner\Logging\*" -Destination $NewPath -Recurse
If you have any template script please do share
Thanks
It is possible to run PowerShell scripts from a C# block action.
Example:
"{
var ps1File = @"C:\my script folder\script.ps1";
var startInfo = new ProcessStartInfo()
{
FileName = "powershell.exe",
Arguments = $"-NoProfile -ExecutionPolicy unrestricted -file \"{ps1File}\"",
UseShellExecute = false
};
Process.Start(startInfo);
}"
You can also manage PowerShell Scripts directly:
Adding and invoking commands - PowerShell | Microsoft Docs
The example is pseudo code. It is not made to actually run as code.
You need to follow the C# rules in order to let this work, like adding the needed namespaces.
Also, the pesudo code is based on C# version 8.0
i tried this script have 5 valid errors!