Video Tutorial
OS Architecture (32 or 64 bit) using PowerShell
Today we are going to discuss about 4 ways to find OS architecture using PowerShell and check if it is 32 or 64 BIT operating system:
-
Using Environment Variables:
$Env
or[System.Environment]
First approach I’m going to demonstrate here is using the Environment variables, so
-
Using
Get-WMIObject
orGet-CIMInstance
cmdletsPowerShell can also be used to query this information from WMI or CIM classes like
Win32_OperatingSystem
,CIM_OperatingSystem
,Win32_Processor
-
Using Native CMD commands:
wmic
We can also use native commands in PowerShell like: wmic in the following example
-
Using
System.IntPtr
typeFinally, fourth and last approach is using .Net type
System.IntPtr
, which is an integer whose size is platform-specific. Either 4 or 8.
That means, if we use[System.IntPtr]::Size
it will then return platform architecture type in Bytes (1 Byte = 8 Bits) so 8 byte is equals to 8*8 = 64 Bits.
If you like this article read more similar articles under ‘N – Ways to’ category
- 4 ways to send output to NULL in PowerShell
- 3 ways to store and display PowerShell Variable simultaneously
- 4 ways to select Unique items in PowerShell
- 4 Ways to Create PowerShell Objects
My New Book : PowerShell Scripting Guide to Python
This PowerShell Scripting guide to Python is designed to make readers familiar with syntax, semantics and core concepts of Python language, in an approach that readers can totally relate with the concepts of PowerShell already in their arsenal, to learn Python fast and effectively, such that it sticks with readers for longer time.
“Use what you know to learn what you don’t. ” also known as Associative learning.
Book follows a comparative method to jump start readers journey in Python, but who is the target audience? and who should read this book –
- Any System Administrator who want to step into Development or Programming roles, and even if you don’t want to be a developer, knowledge of another scripting language will make your skill set more robust.
- Python Developers who want to learn PowerShell scripting and understand its ease of user and importance to manage any platform.
Python is one of the top programming languages and in fast changing IT scenarios to DevOps and Cloudto the future – Data Science, Artificial Intelligence (AI) and Machine Learning Python is a must know.
But this PowerShell Scripting guide to Python would be very helpful for you if you already have some knowledge of PowerShell
NOTE! This is a Leanpub “Agile-published” book. That means the book is currently unfinished and in-progress. As I continue to complete the chapters, we will re-publish the book with the new and updated content. Readers will receive an email once a new version is published!
While the book is in progress, please review it and send any feedback or error corrections at prateek@ridicurious.com