New-ServerRestart

所属分类:其他
开发工具:PowerShell
文件大小:0KB
下载次数:0
上传日期:2023-11-12 03:26:18
上 传 者sh-1993
说明:  用于计划远程服务器的一次性重新启动的示例ScriptoForm。演示:使用日期时间选择器控件和文本框vali...
(A sample ScriptoForm used to schedule a onetime restart of a remote server. Demonstrates: using a datetimepicker control and textbox validation.)

文件列表:
Build/ (0, 2023-11-21)
Build/Build.cs (6743, 2023-11-21)
Build/Build.csproj (1131, 2023-11-21)
LICENSE (1074, 2023-11-21)
New-ServerRestart.ps1 (9203, 2023-11-21)

# New-ServerRestart **Warning:** This ScriptoForm is for demonstration purposes only and not intended for use in a production environment. This repository contains all files required to build the **New-ServerRestart** ScriptoForm project. A *ScriptoForm* is a PowerShell script that generates and displays a [Microsoft Windows Forms](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/overview/?view=netdesktop-8.0#introduction) application that can be used for a specific management or system administration task in a network environment. A *ScriptoForm project* is the set of files and folders, including the PowerShell script, that can be compiled into an executable file using the Microsoft .NET CLI utility (dotnet.exe) which is available with any [Microsoft .NET SDK](https://dotnet.microsoft.com/en-us/download/dotnet). Included in the repository is the Build.cs C# file which the compiler will use as the source for the executable, and the Build.csproj C# project file which provides the set of instructions used to compile the executable. ## Purpose The **New-ServerRestart** script launches a Windows form that provides a method to schedule a one time restart on a remote server. ![Screenshot 2023-05-17 211734](https://github.com/Smart-Ace-Designs/New-ServerRestart/assets/132539186/5c606b54-caf6-4198-b525-60e85f241daa) ## Requirements - This project supports the following command shells: - [Windows PowerShell 5.1](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-5.1) - [PowerShell 7.2.x](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.2) - [PowerShell 7.3.x](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.3) - [PowerShell 7.4.x](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.4) - This project supports the following Microsoft .NET frameworks: - [Microsoft .NET 4.x](https://dotnet.microsoft.com/en-us/download/dotnet-framework) - [Microsoft .NET 6.x](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) - [Microsoft .NET 7.x](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) - [Microsoft .NET 8.x](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) ## Compile Instructions Perform the following prerequisite steps: - Install the [Microsoft .NET 8.x SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) on your development machine. - Clone the repository to your development machine. Use any of the below workflows to create an executable file of the PowerShell script that is compatible with the framework version specified: Microsoft .NET 4.x Framework - Open a supported command shell and navigate to the *Build* subdirectory in your local repository directory. - Run the following command from within your *Build* subdirectory:
``dotnet publish -f net48 -v q -nologo -o ..\Release\Legacy; dotnet clean -f net48 -v q -nologo`` - The compiled executable will be created in the *Release\Legacy* subdirectory of your local repository directory. This location can be changed by modifying the ``-o`` parameter in the above command. - The latest [Microsoft .NET 4.x Framework Runtime](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48) will be required on any computer used to run the executable. Microsoft .NET 6.x Framework - Open a supported command shell and navigate to the *Build* subdirectory in your local repository directory. - Run the following command from within your *Build* subdirectory:
``dotnet publish -f net6.0-windows -v q -nologo -o ..\Release\LTS-Legacy; dotnet clean -f net6.0-windows -v q -nologo`` - The compiled executable will be created in the *Release\LTS-Legacy* subdirectory of your local repository directory. This location can be changed by modifying the ``-o`` parameter in the above command. - The latest [Microsoft .NET 6.x Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) will be required on any computer used to run the executable. Microsoft .NET 7.x Framework - Open a supported command shell and navigate to the *Build* subdirectory in your local repository directory. - Run the following command from within your *Build* subdirectory:
``dotnet publish -f net7.0-windows -v q -nologo -o ..\Release\STS; dotnet clean -f net7.0-windows -v q -nologo`` - The compiled executable will be created in the *Release\STS* subdirectory of your local repository directory. This location can be changed by modifying the ``-o`` parameter in the above command. - The latest [Microsoft .NET 7.x Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) will be required on any computer used to run the executable. Microsoft .NET 8.x Framework - Open a supported command shell and navigate to the *Build* subdirectory in your local repository directory. - Run the following command from within your *Build* subdirectory:
``dotnet publish -f net8.0-windows -v q -nologo -o ..\Release\LTS; dotnet clean -f net8.0-windows -v q -nologo`` - The compiled executable will be created in the *Release\LTS* subdirectory of your local repository directory. This location can be changed by modifying the ``-o`` parameter in the above command. - The latest [Microsoft .NET 8.x Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) will be required on any computer used to run the executable. ## Executable Notes - When the executable file is run it will extract all resource files that were included in the compilation process to a unique temporary extraction directory in the user's profile directory. - The executable will attempt to use the latest version of PowerShell discovered on the local machine to execute the extracted script file unless excluded by one of the command-line arguments noted below. If a version of PowerShell is excluded by a command-line argument then the executable will attempt to use the next latest version of PowerShell discovered on the system. The executable will always default to using Windows PowerShell if no other versions are available for use. - After the PowerShell script execution has completed, all extracted files and the extraction directory are deleted and the executable terminates. - The following optional command-line arguments can be used to control operation of the executable: | Argument | Purpose | Notes | | ----------------- | --------------------------------- | ------------------------------------------------------------| | -Exclude:ALL | Exclude PowerShell x.x.x versions | Do not use with other *Exclude* parameters | | -Exclude:PS7 | Exclude PowerShell 7.x.x versions | Do not use with other *Exclude* parameters | | -Debug | Show console window | Use individually or with one additional *Exclude* parameter |

近期下载者

相关文件


收藏者