From the course: PowerShell 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating a parameterized script

Creating a parameterized script - PowerShell Tutorial

From the course: PowerShell 5 Essential Training

Start my 1-month free trial

Creating a parameterized script

- I'm gonna start by building a typical script. But I'm gonna show you how to advance this into something better than just a regular script, turning this into a useful tool. First of all, I like to solve my problem at the console. What I'm gonna use is something from what's called a WMI and CIM. I'm gonna use a command called CimInstance. This gives me access to a series of classes that can get information for me. I'm gonna grab some disk information, logicaldisk, and I would like to grab this. If I run it right now, you can see I'm getting my drive information. I can pipe this to get-member. There's a bunch of properties I'm actually receiving about my disk. But I wanna filter this. This is filtering to the left. I wanna filter on DeviceID= just the C drive for right now. So I'm getting my C drive information. I wanna get it from a different computer. So I'm gonna use ComputerName DC. That's coming from my domain controller rather than my local machine. I don't want all of these…

Contents