This commit is contained in:
NoryiE
2025-02-10 06:00:28 +00:00
parent b0a4a6da9c
commit 71a1fce096
2428 changed files with 0 additions and 1005324 deletions

View File

@@ -1,22 +0,0 @@
## Define the service name in a variable
$ServiceName = 'EventLog'
## Read the service from Windows to return a service object
$ServiceInfo = Get-Service -Name $ServiceName
## If the server is not running (ne)
if ($ServiceInfo.Status -ne 'Running') {
## Write to the console that the service is not running
Write-Host 'Service is not started, starting service'
## Start the service
Start-Service -Name $ServiceName
## Update the $ServiceInfo object to reflect the new state
$ServiceInfo.Refresh()
## Write to the console the Status property which indicates the state of the service
Write-Host $ServiceInfo.Status
} else { ## If the Status is anything but Running
## Write to the console the service is already running
Write-Host 'The service is already running.'
}
## From https://adamtheautomator.com/powershell-script-examples/