You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vNugglets.Utility/vNugglets.Utility.psd1
+24-17Lines changed: 24 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
#
4
4
# Generated by: Matt Boren
5
5
#
6
-
# Generated on: 6/18/2017
6
+
# Generated on: 1/19/2023
7
7
#
8
8
9
9
@{
@@ -12,7 +12,7 @@
12
12
RootModule='vNuggletsUtilityMod.psm1'
13
13
14
14
# Version number of this module.
15
-
ModuleVersion='1.2.0'
15
+
ModuleVersion='1.3.0'
16
16
17
17
# Supported PSEditions
18
18
# CompatiblePSEditions = @()
@@ -27,25 +27,25 @@ Author = 'Matt Boren'
27
27
CompanyName='vNugglets.com'
28
28
29
29
# Copyright statement for this module
30
-
Copyright='MIT License'
30
+
Copyright='Apache 2.0 License'
31
31
32
32
# Description of the functionality provided by this module
33
33
Description='Module with the super useful functions that were previously scattered about the web by the vNugglets team (particularly, at vNugglets.com)'
34
34
35
-
# Minimum version of the Windows PowerShell engine required by this module
36
-
PowerShellVersion='4.0'
35
+
# Minimum version of the PowerShell engine required by this module
36
+
PowerShellVersion='5.0'
37
37
38
-
# Name of the Windows PowerShell host required by this module
38
+
# Name of the PowerShell host required by this module
39
39
# PowerShellHostName = ''
40
40
41
-
# Minimum version of the Windows PowerShell host required by this module
41
+
# Minimum version of the PowerShell host required by this module
42
42
# PowerShellHostVersion = ''
43
43
44
44
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45
45
# DotNetFrameworkVersion = ''
46
46
47
47
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48
-
#CLRVersion = ''
48
+
#ClrVersion = ''
49
49
50
50
# Processor architecture (None, X86, Amd64) required by this module
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
Copy file name to clipboardExpand all lines: vNugglets.Utility/vNuggletsUtilityMod_functions.ps1
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1428,3 +1428,45 @@ function Invoke-VNEvacuateDatastore {
1428
1428
} ## end foreach-object
1429
1429
} ## end process
1430
1430
} ## end fn
1431
+
1432
+
1433
+
functionGet-VNInventoryType {
1434
+
<#.Description
1435
+
Function to determine possible "correct" object type(s) to use from a vSphere inventory object, as described by Alan Renouf at http://blogs.vmware.com/PowerCLI/2016/04/powercli-best-practice-correct-use-strong-typing.html.
1436
+
1437
+
This is super helpful for when trying to determine most future-"safe" VMware object model types to use for parameter type-ing for our own functions/cmdlets
Get the parent types of the VM object's type that include ".Types." in the name, of which "VMware.VimAutomation.Types.VirtualMachine" is probably a winner for subsequent use
1448
+
#>
1449
+
[CmdletBinding()]
1450
+
[OutputType([System.Type])]
1451
+
param(
1452
+
## The vSphere object(s) for which to get so-called "safe" or "correct" Types for use in code
## Switch: return all types for this object type that contain ".Types." in their full name? (instead of just ones that match the "Impl" type name without the "Impl" string in them)
1456
+
[Switch]$ReturnTypesType
1457
+
) ## end param
1458
+
1459
+
process {
1460
+
$RelatedObject|Foreach-Object {
1461
+
$oThisEntity=$_
1462
+
$oThisEntityType=$_.GetType()
1463
+
## if "return all .Types.* types" switch is $true, return the full list of supported ".Types." types for this object
## get the "future-safer" full type info for this object type, if any (essentially the same typename, but without the "Impl" portion in the it, if there is such a type)
0 commit comments