Skip to content

Commit

Permalink
v2 logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Ward committed Dec 2, 2023
1 parent f989c7b commit 617fcb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Segment/Troubleshooting/ZN_Troubleshooter_v01.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
#>

## Run as admin if not as admin
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit
}

function Write-Coord {
param(
Expand Down
12 changes: 11 additions & 1 deletion Segment/Troubleshooting/ZN_Troubleshooter_v02.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,22 @@ if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
{
# If not running as admin, write an error message and exit
Write-Error "This script requires administrative privileges. Please run it as an administrator."
exit
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit
#exit
}

# Define the path for the log file
$logFilePath = "C:\temp\zeronetworksts.txt"

# Get the directory path from the file path
$folderPath = Split-Path -Path $logFilePath

# Check if the folder exists
if (-not (Test-Path -Path $folderPath)) {
# The folder does not exist, so create it
New-Item -ItemType Directory -Path $folderPath
}

function Check-ServiceStatus {
param (
[string]$ServiceName,
Expand Down

0 comments on commit 617fcb1

Please sign in to comment.