Hangfire.PowerShellExecutor
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Hangfire.PowerShellExecutor --version 1.0.0
NuGet\Install-Package Hangfire.PowerShellExecutor -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hangfire.PowerShellExecutor" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hangfire.PowerShellExecutor --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Hangfire.PowerShellExecutor, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Hangfire.PowerShellExecutor as a Cake Addin #addin nuget:?package=Hangfire.PowerShellExecutor&version=1.0.0 // Install Hangfire.PowerShellExecutor as a Cake Tool #tool nuget:?package=Hangfire.PowerShellExecutor&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Hangfire.PowerShellExecutor
A plugin for Hangfire that allows you to easily launch your powershell scripts.
Read about hangfire here: https://github.com/HangfireIO/Hangfire here: http://hangfire.io
Features
- Noob Friendly: Allow to easily launch your powershell scripts.
- 100% Safe: no Hangfire-managed data (e.g. jobs, states) is ever updated, hence there's no risk to corrupt it.
- (blah-blah-blah)
Setup
Install NuGet package, and configure the console in .NET Core's Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(config =>
{
config.UseSqlServerStorage("connectionSting");
config.UseConsole();
});
}
Otherwise,
GlobalConfiguration.Configuration
.UseSqlServerStorage("connectionSting")
.UseConsole();
NOTE: If you have Dashboard and Server running separately,
you'll need to call UseConsole()
on both.
Example
using Hangfire.Console;
using Hangfire.Server;
using System.Threading;
using System.Threading.Tasks;
namespace Hangfire.PowerShellExecutor.Jobs
{
public class PowerShellJob
{
public async Task ExecuteAsync(PerformContext context, CancellationToken cancellationToken)
{
context.SetTextColor(ConsoleTextColor.Green);
context.WriteLine("*****************************************************************");
context.WriteLine("Starting: Hangfire Script");
context.WriteLine("*****************************************************************");
context.ResetTextColor();
// Create an instance of the configuration
var psConfig = new PsExecutorConfig();
// Define the execution policy
psConfig.SetExecutionPolicy(ExecutionPolicy.Bypass);
// Add parameters
psConfig.AddSecret("PE_SUPERSECRET", "P@ssw0rd");
psConfig.AddParameter("PE_PARAMETER01", "parameter01");
psConfig.AddParameter("PE_PARAMETER02", "parameter02");
// Set the location of the powershell script
psConfig.SetScriptPath(@"D:\Scripts\Get-ChildItem.ps1");
// Execute the powershell script
context.StartProcess(psConfig, cancellationToken);
context.WriteLine("");
context.SetTextColor(ConsoleTextColor.Green);
context.WriteLine("*****************************************************************");
context.WriteLine("Finishing: Hangfire Script");
context.WriteLine("*****************************************************************");
}
}
}
License
Authored by: Thomas ILLIET
This project is under MIT license. You can obtain the license copy here.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Hangfire.Console (>= 1.4.2)
- Hangfire.Core (>= 1.7.24)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.