From the course: Complete Guide to PowerShell 7
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Running scripts interactively - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
Running scripts interactively
- [Instructor] Now for this example, I've brought back the PowerShell terminal on the right hand side, which is PowerShell 7.0, and I'm actually going to minimize this bottom section here. We don't need this one here. Let's go all the way back down. And what we're going to look at is interactively executing a PowerShell script. Before we do that though, we need to look at what the script actually does. So let me just slide this across here so we can see. Well, first off, what we're going to do here is we're going to define a log file path, which will be DiskSpaceLog.txt. Then we're going to go ahead and in that specific location, we're going to put that log file, so we're going to generate it. We are then going to generate this new function called log that would allow us to log entries directly into that too. The next thing we're going to do is go and check all of the disk space. We're going to use the Get-PSDrive with the specific file system provider, loop through each drive and do…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Basic command structure12m 11s
-
(Locked)
Running simple commands6m 45s
-
(Locked)
Using Get-Command6m 15s
-
(Locked)
Using Get-Help5m 57s
-
(Locked)
Common cmdlets overview6m 57s
-
(Locked)
Managing processes with Get-Process8m 1s
-
(Locked)
Working with services6m 37s
-
(Locked)
Running scripts interactively5m 22s
-
-
-
-
-
-
-
-
-
-
-