How to find the primary drive in windows using powershell

Introduction

At times we may have to find some space in the machine where we can store some data. We cannot guess the drive as it may be different on different machine. With powershell we can find the drive to where the OS is mounted and can try to store the data there. The below line of code will help you achieve this using powershell.

$disk = Get-WmiObject -Class Win32_logicaldisk -Filter "VolumeName = 'OSDisk'"
echo ($disk.Properties | Where-Object{ $_.Name -eq  "Caption"}).Value.Trim();

Setting Up Kafka

Apache Kafka is a high-throughput, low-latency event processing system designed to handle millions of data feeds per second. It has the c...… Continue reading

Libish Varghese Jacob

Libish Varghese JacobI am currently working as a lead engineer in one of the leading wind turbine manufacturing firm. I have wide range of interests and getting my hands dirty in technology is one among them. I use this platform primarily as my knowledge base. I also use this platform to share my experience and experiments so that it might help someone who is walking the way I already did. The suggestions expressed here are the best to my knowledge at the time of writing and this may not necessarily be the best possible solution. I would pretty much appreciate if you could comment on it to bring into my notice on what could have been done better.