|
1 | 1 | Function GetTPMInstances(ByRef arrTPMInstances) |
2 | | - 'region FunctionMetadata #################################################### |
3 | | - ' Assuming that objWMINamespace represents a successful connection to the a TPM WMI |
4 | | - ' namespace, this function retrieves the available TPM instances as objects of the class |
| 2 | + 'region FunctionMetadata ####################################################### |
| 3 | + ' This function retrieves the available TPM instances as objects of the class |
5 | 4 | ' Win32_Tpm. Typically, there is only one TPM available on a computer. |
6 | 5 | ' |
7 | | - ' The function takes two positional arguments: |
8 | | - ' - The first argument (arrTPMInstances) is populated upon success with a collection of |
9 | | - ' TPM instances of the type Win32_Tpm |
10 | | - ' - The second argument (objWMINamespace) is a WMI Namespace connection argument that must |
11 | | - ' already be connected to the WMI namespace root\cimv2\Security\MicrosoftTpm |
| 6 | + ' The function takes one positional argument (arrTPMInstances), which is populated |
| 7 | + ' upon success with a collection of TPM instances of the type Win32_Tpm |
12 | 8 | ' |
13 | | - ' The function returns the number of TPM instances retrieved. A successful function call |
14 | | - ' returns a positive integer. The function will return 0 if no error occurred, but no TPMs |
15 | | - ' were present. Finally, the function returns a negative integer if an error occurs. |
| 9 | + ' The function returns the number of TPM instances retrieved. A successful function |
| 10 | + ' call returns a positive integer. The function will return 0 if no error occurred, |
| 11 | + ' but no TPMs were present. Finally, the function returns a negative integer if an |
| 12 | + ' error occurs. |
16 | 13 | ' |
17 | 14 | ' Example: |
18 | 15 | ' intReturnCode = GetTPMInstances(arrTPMInstances) |
19 | 16 | ' If intReturnCode > 0 Then |
20 | 17 | ' ' At least one TPM was retrieved successfully |
21 | 18 | ' End If |
22 | 19 | ' |
23 | | - ' Version: 1.0.20210615.0 |
24 | | - 'endregion FunctionMetadata #################################################### |
| 20 | + ' Version: 1.0.20210615.1 |
| 21 | + 'endregion FunctionMetadata ####################################################### |
25 | 22 |
|
26 | | - 'region License #################################################### |
| 23 | + 'region License ################################################################ |
27 | 24 | ' Copyright 2021 Frank Lesniak |
28 | 25 | ' |
29 | | - ' Permission is hereby granted, free of charge, to any person obtaining a copy of this |
30 | | - ' software and associated documentation files (the "Software"), to deal in the Software |
31 | | - ' without restriction, including without limitation the rights to use, copy, modify, merge, |
32 | | - ' publish, distribute, sublicense, and/or sell copies of the Software, and to permit |
33 | | - ' persons to whom the Software is furnished to do so, subject to the following conditions: |
| 26 | + ' Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 27 | + ' this software and associated documentation files (the "Software"), to deal in the |
| 28 | + ' Software without restriction, including without limitation the rights to use, |
| 29 | + ' copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
| 30 | + ' Software, and to permit persons to whom the Software is furnished to do so, |
| 31 | + ' subject to the following conditions: |
34 | 32 | ' |
35 | | - ' The above copyright notice and this permission notice shall be included in all copies or |
36 | | - ' substantial portions of the Software. |
| 33 | + ' The above copyright notice and this permission notice shall be included in all |
| 34 | + ' copies or substantial portions of the Software. |
37 | 35 | ' |
38 | | - ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
39 | | - ' INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
40 | | - ' PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
41 | | - ' FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
42 | | - ' OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
43 | | - ' DEALINGS IN THE SOFTWARE. |
44 | | - 'endregion License #################################################### |
| 36 | + ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 37 | + ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 38 | + ' FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 39 | + ' COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 40 | + ' AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 41 | + ' WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 42 | + 'endregion License ################################################################ |
45 | 43 |
|
46 | | - 'region DownloadLocationNotice #################################################### |
47 | | - ' The most up-to-date version of this script can be found on the author's GitHub repository |
48 | | - ' at https://github.com/franklesniak/sysadmin-accelerator |
49 | | - 'endregion DownloadLocationNotice #################################################### |
| 44 | + 'region DownloadLocationNotice ################################################# |
| 45 | + ' The most up-to-date version of this script can be found on the author's GitHub |
| 46 | + ' repository at https://github.com/franklesniak/sysadmin-accelerator |
| 47 | + 'endregion DownloadLocationNotice ################################################# |
50 | 48 |
|
51 | | - 'region Acknowledgements #################################################### |
52 | | - ' Microsoft and Sven Aelterman, for providing ZTICheckForTPM/ZTICheckForTPM_v2, which |
53 | | - ' inspired this approach. |
54 | | - 'endregion Acknowledgements #################################################### |
| 49 | + 'region Acknowledgements ####################################################### |
| 50 | + ' Microsoft and Sven Aelterman, for providing ZTICheckForTPM/ZTICheckForTPM_v2, |
| 51 | + ' which inspired this approach. |
| 52 | + 'endregion Acknowledgements ####################################################### |
55 | 53 |
|
56 | | - 'region DependsOn #################################################### |
| 54 | + 'region DependsOn ############################################################## |
57 | 55 | ' ConnectLocalTPMWMINamespace() |
58 | 56 | ' GetTPMInstancesUsingWMINamespace() |
59 | | - 'endregion DependsOn #################################################### |
| 57 | + 'endregion DependsOn ############################################################## |
60 | 58 |
|
61 | 59 | Dim intFunctionReturn |
62 | 60 | Dim intReturnMultiplier |
|
0 commit comments