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 - PowerShell Tutorial
From the course: PowerShell 5 Essential Training
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
-
-
-
-
-
-
-
-
(Locked)
Exploring PowerShell automation security7m 1s
-
(Locked)
Creating your first script6m 41s
-
Using variables for storage6m 11s
-
(Locked)
Using the Integrated Scripting Environment (ISE)6m 12s
-
(Locked)
Creating a parameterized script7m 6s
-
(Locked)
Using parameter attributes6m 36s
-
(Locked)
Using comment-based help5m 33s
-
(Locked)
-
-