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.
Using Out-String and Out-Host - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
Using Out-String and Out-Host
- [Instructor] Now when working with values in PowerShell, obviously when we try to output things, there are various capabilities available to us. So the first one is what's called out-string. So I've got my list of processes here. So I'm going to say get process. You can see what comes back is a list like that. I'm going to actually populate this into a variable and say out string. Now when I go to my output here, what I end up with is just the same kind of table as before and I can say, write output, and it'll just write the output out as a string object. So it will process the list and convert it into a single string object. Now that's not always useful, especially when you have a vast amount of data like this, because normally data you want to iterate. However, you can convert all of that to a singular object. So let's just clear this bottom section here. I also can use what's called out-host, which will just display the output directly to the console. So I'm going to say Get…
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
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Introduction to output paths11m 16s
-
Using Out-File for file output9m 38s
-
(Locked)
Using Out-GridView for interactive output7m 47s
-
(Locked)
Using Out-String and Out-Host4m 18s
-
(Locked)
Exporting data to CSV10m 11s
-
(Locked)
Exporting data to JSON9m 13s
-
(Locked)
Exporting data to XML7m 58s
-
(Locked)
Creating custom output formats3m 53s
-
(Locked)
-
-
-
-
-