diff --git a/Private/Get-Hostname.ps1 b/Private/Get-Hostname.ps1 index 9955d68..caed4e1 100644 --- a/Private/Get-Hostname.ps1 +++ b/Private/Get-Hostname.ps1 @@ -1,4 +1,4 @@ -function Get-Hostname ($name) { +function Get-Hostname ([string]$name) { if ($name.Length -eq 5) { $res = Get-AssetConversion $name if ($res) { return $res } diff --git a/Private/PCMonitor.ps1 b/Private/PCMonitor.ps1 index 36b0233..35bb166 100644 --- a/Private/PCMonitor.ps1 +++ b/Private/PCMonitor.ps1 @@ -27,11 +27,7 @@ function Invoke-PCMonitor { if ($notify) { $null = [System.Windows.MessageBox]::Show($msg) } -<<<<<<< HEAD - Write-Host "$msg" -NoNewline -======= Write-Output "$msg" ->>>>>>> HostnameRefactor } } # Update date and time so user knows script hasn't frozen @@ -119,14 +115,13 @@ class WatchDog { } } if ($old.LastUser -ne $this.LastUser) { - if ($old.LastUser -and $this.LastUser) { - $msg += "$date $($this.Hostname) | $($old.LastUser) logged off and $($this.LastUser) logged on`r`n" - } elseif ($old.LastUser -ne "") { + if ($old.LastUser -ne "") { $msg += "$date $($this.Hostname) | $($old.LastUser) logged off`r`n" - } elseif ($this.LastUser -ne "") { + } + if ($this.LastUser -ne "") { $msg += "$date $($this.Hostname) | $($this.LastUser) logged on`r`n" } } - return $msg + return $msg.Trim() } } \ No newline at end of file