-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-OSArchitecture.ps1
81 lines (76 loc) · 1.87 KB
/
Get-OSArchitecture.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<#
.Synopsis
Short description
This script will be used for validating the OS architecture (64 or 32-bit) in the target system.
.DESCRIPTION
Long description
2021-02-06 Sukri Created.
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
.INPUTS
Inputs to this cmdlet (if any)
.OUTPUTS
Output from this cmdlet (if any)
.NOTES
General notes
Author : Sukri Kadir
Email : [email protected]
.COMPONENT
The component this cmdlet belongs to
.ROLE
The role this cmdlet belongs to
.FUNCTIONALITY
The functionality that best describes this cmdlet
#>
function Get-OSArchitecture
{
Param
(
#parameter for query statement for OS Architecture.
[ValidateNotNullOrEmpty()]
[String]
$QueryOSArchitecture = "Select OSArchitecture from Win32_OperatingSystem"
)
Begin
{
#get OS Architecture.
$OSArchitecture = (Get-WmiObject -Query "Select OSArchitecture from Win32_OperatingSystem").OSArchitecture
}
Process
{
#identify which OS Architecture.
if ($OSArchitecture)
{
#for 64-bit OS Architecture.
if ($OSArchitecture -eq "64-bit")
{
$OSArchitectureBit = $OSArchitecture
}
#for 32-bit OS Architecture.
if ($OSArchitecture -ne "64-bit")
{
$OSArchitectureBit = $OSArchitecture
}
}
#return null if OS Architecture is empty.
if (!$OSArchitecture)
{
$OSArchitectureBit = $null
}
}
End
{
#return true if values available.
if ($OSArchitectureBit)
{
return $true, $OSArchitectureBit
}
#return true if values available.
if ($OSArchitectureBit)
{
return $false
}
}
}