Skip to content
Snippets Groups Projects
Commit aedeba84 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Automatic formatting

parent 3bc4af97
Branches
Tags
No related merge requests found
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
[CmdletBinding()] [CmdletBinding()]
Param( Param(
[Parameter(Mandatory=$False)][switch] $StartService [Parameter(Mandatory = $False)][switch] $StartService
) )
function Start-MyService { function Start-MyService {
...@@ -18,8 +18,7 @@ function Start-MyService { ...@@ -18,8 +18,7 @@ function Start-MyService {
try { try {
Start-Service $ServiceName Start-Service $ServiceName
Write-Host "[OK]" -Fore Green Write-Host "[OK]" -Fore Green
} } catch {
catch {
$ex = $_.Exception $ex = $_.Exception
Write-Host "[FAILED]" -Fore Red Write-Host "[FAILED]" -Fore Red
Write-Host $ex.Message Write-Host $ex.Message
...@@ -45,8 +44,7 @@ function Copy-ServiceFiles { ...@@ -45,8 +44,7 @@ function Copy-ServiceFiles {
# create a dummy log file, so admins can already start watching it: # create a dummy log file, so admins can already start watching it:
Out-File -FilePath $ServiceLog -InputObject "$($ServiceName) installed" -Encoding utf8 Out-File -FilePath $ServiceLog -InputObject "$($ServiceName) installed" -Encoding utf8
Write-Host "[OK]" -Fore Green Write-Host "[OK]" -Fore Green
} } catch {
catch {
$ex = $_.Exception $ex = $_.Exception
Write-Host "[FAILED]" -Fore Red Write-Host "[FAILED]" -Fore Red
Write-Host $ex.Message Write-Host $ex.Message
...@@ -73,15 +71,13 @@ function Add-PerfMonGroupMember { ...@@ -73,15 +71,13 @@ function Add-PerfMonGroupMember {
try { try {
Add-LocalGroupMember -Group $GroupName -Member $ServiceUser Add-LocalGroupMember -Group $GroupName -Member $ServiceUser
Write-Host $("Successfully added user [$($ServiceUser)] to the local" Write-Host $("Successfully added user [$($ServiceUser)] to the local"
"group [$($GroupName)].") "group [$($GroupName)].")
} } catch [Microsoft.PowerShell.Commands.MemberExistsException] {
catch [Microsoft.PowerShell.Commands.MemberExistsException] {
Write-Host $("User [$($ServiceUser)] is already a member of the local" Write-Host $("User [$($ServiceUser)] is already a member of the local"
"group [$($GroupName)], no action required.") "group [$($GroupName)], no action required.")
} } catch {
catch {
Write-Host $("Adding user [$($ServiceUser)] to the local group" Write-Host $("Adding user [$($ServiceUser)] to the local group"
"[$($GroupName)] failed: $($_.Exception.Message)") "[$($GroupName)] failed: $($_.Exception.Message)")
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment