Skip to content

Commit 24e7535

Browse files
committed
Added help. Added parameter. Added outputtype attribute
1 parent f5e148b commit 24e7535

1 file changed

Lines changed: 49 additions & 2 deletions

File tree

internal/functions/Test-PSDCHyperVEnabled.ps1

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,54 @@
1-
function Test-PSDCHyperVEnabled {
1+
function Test-PSDCHyperVEnabled {
2+
<#
3+
.SYNOPSIS
4+
Test-PSDCHyperVEnabled tests if Hyper-V is enabled
5+
6+
.DESCRIPTION
7+
For the module to work properly the module needs Hyper-V to be enabled
8+
The function tests is that's the case
9+
10+
.PARAMETER HostName
11+
Hostname to check. The default is the current hostname
12+
13+
.PARAMETER EnableException
14+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
15+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
16+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
17+
18+
.PARAMETER WhatIf
19+
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
20+
21+
.PARAMETER Confirm
22+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
23+
24+
.NOTES
25+
Author: Sander Stad (@sqlstad, sqlstad.nl)
26+
27+
Website: https://psdatabaseclone.io
28+
Copyright: (C) Sander Stad, sander@sqlstad.nl
29+
License: MIT https://opensource.org/licenses/MIT
30+
31+
.LINK
32+
https://psdatabaseclone.io/
33+
34+
.EXAMPLE
35+
Test-PSDCHyperVEnabled -HostName APPSRV1
36+
37+
Test if APPSRV1 has Hyper-V enabled
38+
39+
.EXAMPLE
40+
Test-PSDCHyperVEnabled
41+
42+
Test if the current host has Hyper-V enabled
43+
#>
44+
45+
[CmdLetbinding()]
46+
47+
[OutputType([bool])]
248

349
param(
4-
[string]$HostName = $env:COMPUTERNAME
50+
[string]$HostName = $env:COMPUTERNAME.
51+
[switch]$EnableException
552
)
653

754
$osDetails = Get-CimInstance Win32_OperatingSystem -ComputerName $HostName | Select-Object Caption, Description, Name, OSType, Version

0 commit comments

Comments
 (0)