WEBVTT

1
00:00:00.080 --> 00:00:04.040
<v Speaker 1>Okay, let's unpack this. Imagine you're trying to get your

2
00:00:04.080 --> 00:00:06.480
<v Speaker 1>computer to do more for you, maybe sort through a

3
00:00:06.559 --> 00:00:10.160
<v Speaker 1>huge pile of files, automate some boring task, or just

4
00:00:10.759 --> 00:00:12.839
<v Speaker 1>peek under the hood a bit see how things really tick.

5
00:00:13.199 --> 00:00:15.759
<v Speaker 1>If that sounds like you, well, then this deep dive

6
00:00:15.839 --> 00:00:19.239
<v Speaker 1>is going to be incredibly insightful. Today we're diving into

7
00:00:19.280 --> 00:00:23.320
<v Speaker 1>Windows PowerShell. It's this really powerful tool that honestly transforms

8
00:00:23.320 --> 00:00:26.519
<v Speaker 1>how you interact with and manage your Windows systems. We

9
00:00:26.600 --> 00:00:29.039
<v Speaker 1>spend a lot of time going through a pretty comprehensive

10
00:00:29.079 --> 00:00:32.359
<v Speaker 1>cookbook on it, pulling out the best bits. Our mission

11
00:00:32.399 --> 00:00:34.920
<v Speaker 1>today cut through the jargon, give you the essentials of

12
00:00:34.960 --> 00:00:38.159
<v Speaker 1>what PowerShell is and more importantly, what it can actually

13
00:00:38.159 --> 00:00:38.600
<v Speaker 1>do for you.

14
00:00:38.920 --> 00:00:41.759
<v Speaker 2>Yeah, and what's truly powerful about PowerShell, I think is

15
00:00:41.759 --> 00:00:44.320
<v Speaker 2>that it's just so much more than another command line.

16
00:00:44.399 --> 00:00:47.600
<v Speaker 2>It's really a fundamental shift. It changes how administrators and

17
00:00:47.640 --> 00:00:51.079
<v Speaker 2>even just regular users can manage Windows. It's designed from

18
00:00:51.079 --> 00:00:55.439
<v Speaker 2>the ground up to be robust, consistent, deeply integrated. It

19
00:00:55.520 --> 00:00:59.560
<v Speaker 2>really empowers you to be remarkably efficient. So throughout this

20
00:00:59.640 --> 00:01:02.320
<v Speaker 2>deep I will explore how it manages that, looking at

21
00:01:02.320 --> 00:01:07.280
<v Speaker 2>its unique approach to data. It's incredible discoverability, features, scripting,

22
00:01:07.640 --> 00:01:09.439
<v Speaker 2>and how it connects all these different parts of your

23
00:01:09.439 --> 00:01:11.480
<v Speaker 2>system hashtag, check tag the deep dive.

24
00:01:11.640 --> 00:01:14.159
<v Speaker 1>PowerShell's core philosophy interacting with purpose.

25
00:01:14.319 --> 00:01:16.560
<v Speaker 2>So if you've ever poked around in Windows, you probably

26
00:01:16.560 --> 00:01:19.359
<v Speaker 2>remember the old command prompt right, maybe from Windows XP

27
00:01:19.519 --> 00:01:23.400
<v Speaker 2>or an older server version. PowerShell actually looks pretty similar

28
00:01:23.439 --> 00:01:26.599
<v Speaker 2>at first glance, and yeah, you can run familiar tools

29
00:01:26.640 --> 00:01:29.879
<v Speaker 2>like ipcunfig or even classic DOST commands like CD and dirt.

30
00:01:29.959 --> 00:01:32.480
<v Speaker 2>That still works. But here's where that familiarity kind of

31
00:01:32.560 --> 00:01:35.480
<v Speaker 2>ends and the real power starts to show exactly.

32
00:01:35.079 --> 00:01:38.079
<v Speaker 1>That familiar look. It's quite intentional, makes it less intimidating,

33
00:01:38.159 --> 00:01:41.200
<v Speaker 1>lowers the barrier to entry, you know, beneath that surface.

34
00:01:41.359 --> 00:01:45.040
<v Speaker 1>PowerShell is built on these core principles that prioritize efficiency

35
00:01:45.120 --> 00:01:49.239
<v Speaker 1>and power, especially for anyone managing a Windows system. It's

36
00:01:49.239 --> 00:01:53.840
<v Speaker 1>designed for quick, interactive use. It supports incredible discovery discovery, yeah,

37
00:01:53.920 --> 00:01:56.120
<v Speaker 1>meaning you can find out how to do almost anything

38
00:01:56.120 --> 00:02:00.359
<v Speaker 1>with just a few simple commands. It's amazing. Plus enables

39
00:02:00.439 --> 00:02:03.680
<v Speaker 1>really comprehensive scripting, and it can bridge or sort of

40
00:02:03.959 --> 00:02:08.439
<v Speaker 1>talk to all these different technologies dot net com WMI, XML,

41
00:02:08.560 --> 00:02:12.159
<v Speaker 1>web services, active directory. Yeah, you name it, okay.

42
00:02:12.479 --> 00:02:14.280
<v Speaker 2>And one of the first things I noticed, or that

43
00:02:14.319 --> 00:02:17.000
<v Speaker 2>you'll notice, is the command structure. It seems really logical.

44
00:02:17.159 --> 00:02:20.400
<v Speaker 1>It is. Most commands follow a clear verb noun pattern.

45
00:02:20.159 --> 00:02:21.800
<v Speaker 2>Like get process or stop service.

46
00:02:21.879 --> 00:02:25.199
<v Speaker 1>Precisely get process to see running processes, stop service to

47
00:02:25.199 --> 00:02:28.360
<v Speaker 1>stop a service. It makes guessing new commands really intuitive,

48
00:02:28.520 --> 00:02:31.680
<v Speaker 1>and you quickly pick up shortcuts, use wild cards. You

49
00:02:31.719 --> 00:02:35.000
<v Speaker 1>can get exactly what you need without typing endless commands.

50
00:02:35.240 --> 00:02:38.879
<v Speaker 3>Now, if there's one really big aha the moment we

51
00:02:38.919 --> 00:02:40.439
<v Speaker 3>want you to take away from this deep dive, I

52
00:02:40.479 --> 00:02:44.400
<v Speaker 3>think it's this PowerShell doesn't deal with plaintext in the

53
00:02:44.400 --> 00:02:45.360
<v Speaker 3>way you might expect.

54
00:02:45.439 --> 00:02:48.000
<v Speaker 2>It deals with objects. And to get why this is

55
00:02:48.039 --> 00:02:50.879
<v Speaker 2>such a game changer, think about traditional command line tools.

56
00:02:51.120 --> 00:02:54.240
<v Speaker 2>They often just spit out raw text. Right, So if

57
00:02:54.240 --> 00:02:56.639
<v Speaker 2>you wanted to, I don't know, find all processes using

58
00:02:56.639 --> 00:02:58.520
<v Speaker 2>more than one hundred millibit of memory, you'd have to

59
00:02:58.599 --> 00:03:02.080
<v Speaker 2>use maybe other tools. Our source calls it a black art.

60
00:03:02.199 --> 00:03:03.599
<v Speaker 1>Oh yeah, that's a good way to put it.

61
00:03:03.680 --> 00:03:05.360
<v Speaker 2>To parse that text and pull out the numbers.

62
00:03:05.439 --> 00:03:09.039
<v Speaker 1>And this raises an important question, why is relying on

63
00:03:09.159 --> 00:03:14.759
<v Speaker 1>text such a problem well, because getting structured, meaningful information

64
00:03:14.840 --> 00:03:17.120
<v Speaker 1>out of just, you know, a wall of text is

65
00:03:17.159 --> 00:03:20.240
<v Speaker 1>incredibly difficult. It's slow, it's error prone, well.

66
00:03:20.159 --> 00:03:24.000
<v Speaker 2>Trying to find specific facts in a giant, unformatted book exactly.

67
00:03:24.599 --> 00:03:28.240
<v Speaker 1>PowerShell solves this so elegantly by passing full fidelity objects

68
00:03:28.240 --> 00:03:30.680
<v Speaker 1>through its pipeline. So instead of just a string of

69
00:03:30.759 --> 00:03:35.039
<v Speaker 1>characters everything, PowerShell works with a process, a file, a

70
00:03:35.159 --> 00:03:38.759
<v Speaker 1>user account is a rich object, and these objects have

71
00:03:38.840 --> 00:03:44.400
<v Speaker 1>clearly defined properties like name, id, memory, usage, creation, date,

72
00:03:45.039 --> 00:03:46.439
<v Speaker 1>whatever makes sense for that thing.

73
00:03:46.479 --> 00:03:49.360
<v Speaker 2>Okay, So instead of fighting with text, you're working directly

74
00:03:49.400 --> 00:03:52.039
<v Speaker 2>with structured data that's already organized for you, that.

75
00:03:51.960 --> 00:03:55.560
<v Speaker 1>Makes sense precisely, and that makes actions like filtering super powerful.

76
00:03:55.560 --> 00:03:58.840
<v Speaker 1>You use wear object, rare objects, or sorting with sort objects,

77
00:03:58.919 --> 00:04:01.919
<v Speaker 1>it becomes incredibly precise and clear because you're just saying,

78
00:04:02.280 --> 00:04:04.680
<v Speaker 1>show me objects where the memory property is greater than

79
00:04:04.719 --> 00:04:06.120
<v Speaker 1>one hundred milibet ah, I.

80
00:04:06.039 --> 00:04:08.120
<v Speaker 2>Say, you're working with the properties.

81
00:04:07.639 --> 00:04:10.719
<v Speaker 1>Directly, exactly, and you chain these commands together with that

82
00:04:10.800 --> 00:04:13.319
<v Speaker 1>simple pipe symbol that I know, right, So the output

83
00:04:13.360 --> 00:04:16.439
<v Speaker 1>objects from one command flowed directly as input to the next,

84
00:04:16.800 --> 00:04:18.160
<v Speaker 1>like building with legos.

85
00:04:17.839 --> 00:04:21.240
<v Speaker 2>Almost navigating and manipulating your digital world with objects.

86
00:04:21.519 --> 00:04:25.199
<v Speaker 1>Okay. Building on that object idea, PowerShell takes something you

87
00:04:25.240 --> 00:04:28.120
<v Speaker 1>already know, like navigating files and folders.

88
00:04:28.240 --> 00:04:31.959
<v Speaker 2>Yeah, like using CD and DURR or l's right, and.

89
00:04:31.920 --> 00:04:34.399
<v Speaker 1>It extends that concept to other parts of your computer.

90
00:04:34.839 --> 00:04:38.160
<v Speaker 2>That's right. That's where powershells providers come in. Think of

91
00:04:38.199 --> 00:04:41.279
<v Speaker 2>them like special adapters. They make different data stores in

92
00:04:41.319 --> 00:04:44.439
<v Speaker 2>your system look and feel just like a file system.

93
00:04:45.199 --> 00:04:46.319
<v Speaker 1>So what kind of data stores?

94
00:04:46.519 --> 00:04:50.600
<v Speaker 2>Well, the big ones are the Windows Registry, environment variables,

95
00:04:50.639 --> 00:04:52.920
<v Speaker 2>the certificate store. It means you can use the same

96
00:04:52.959 --> 00:04:56.720
<v Speaker 2>commands set location, which is CD, get child item, dur

97
00:04:56.920 --> 00:04:59.920
<v Speaker 2>or alls get item, new item to navigate and manage

98
00:05:00.000 --> 00:05:01.240
<v Speaker 2>these completely different areas.

99
00:05:01.439 --> 00:05:05.399
<v Speaker 1>So you could type set location HKLM.

100
00:05:04.600 --> 00:05:08.800
<v Speaker 2>Exactly and suddenly you're browsing the hkey local machine part

101
00:05:08.839 --> 00:05:10.639
<v Speaker 2>of the registry, just like it's the Sea drive. It's

102
00:05:10.680 --> 00:05:11.720
<v Speaker 2>incredibly consistent.

103
00:05:11.800 --> 00:05:14.279
<v Speaker 1>Okay, that's pretty cool. And what about actual files? How

104
00:05:14.360 --> 00:05:15.279
<v Speaker 1>versatile is it? There?

105
00:05:15.399 --> 00:05:18.240
<v Speaker 2>Oh? Very You can search for text inside files using

106
00:05:18.279 --> 00:05:21.199
<v Speaker 2>select string like GRIP on Linux kind of yeah, but

107
00:05:21.319 --> 00:05:24.839
<v Speaker 2>remember the object difference. Select string gives you back objects

108
00:05:24.879 --> 00:05:27.759
<v Speaker 2>with details about each match, the line number, the match text,

109
00:05:27.839 --> 00:05:30.560
<v Speaker 2>the file name much richer than just the text.

110
00:05:30.319 --> 00:05:34.439
<v Speaker 1>Line okay, and structured data like XML or CSV absolutely.

111
00:05:34.600 --> 00:05:37.360
<v Speaker 2>For XML, you can literally load the file into an

112
00:05:37.439 --> 00:05:41.120
<v Speaker 2>XML object variable. Then you use dot notation to navigate

113
00:05:41.160 --> 00:05:43.639
<v Speaker 2>and change things and just save it back. Super easy.

114
00:05:43.920 --> 00:05:48.439
<v Speaker 2>And for csvs, which are everywhere right, import CSV is fantastic.

115
00:05:48.800 --> 00:05:51.519
<v Speaker 2>It automatically turns each row into an object and the

116
00:05:51.519 --> 00:05:53.519
<v Speaker 2>column headers become the object properties.

117
00:05:53.560 --> 00:05:55.720
<v Speaker 1>Wow. Okay, so no manual parsing.

118
00:05:55.560 --> 00:05:58.839
<v Speaker 2>None needed. It makes analyzing log files or any CSV

119
00:05:58.959 --> 00:06:02.600
<v Speaker 2>data incredibly forward. And this power extends to modern web

120
00:06:02.600 --> 00:06:05.279
<v Speaker 2>stuff too. If you're interacting with web APIs, which so

121
00:06:05.399 --> 00:06:09.439
<v Speaker 2>much relies on now Jason data usually yep, Jason PowerShell

122
00:06:09.480 --> 00:06:11.839
<v Speaker 2>has built in commands like convert to Jason and convert

123
00:06:11.839 --> 00:06:14.879
<v Speaker 2>from Jason, and even better, invoke rest method which you

124
00:06:14.959 --> 00:06:17.600
<v Speaker 2>used to call. Web APIs can often handle the Jason

125
00:06:17.680 --> 00:06:20.759
<v Speaker 2>conversion automatically for you. It just gives you back objects

126
00:06:20.800 --> 00:06:22.240
<v Speaker 2>directly from the API response.

127
00:06:22.560 --> 00:06:24.839
<v Speaker 1>That simplifies things a lot. Plus I saw. You can

128
00:06:24.879 --> 00:06:28.800
<v Speaker 1>even do things like export data to a CSV file

129
00:06:28.879 --> 00:06:31.439
<v Speaker 1>and then use invoke item on that file.

130
00:06:31.480 --> 00:06:34.040
<v Speaker 2>Then it opens right up and excel yeah on one

131
00:06:34.040 --> 00:06:36.560
<v Speaker 2>command line. It bridges that gap between the command line

132
00:06:36.600 --> 00:06:39.839
<v Speaker 2>and GURI tools really nicely sometimes.

133
00:06:39.439 --> 00:06:42.439
<v Speaker 1>Okay, switching gears slightly. Have you ever hit that wall

134
00:06:42.720 --> 00:06:45.319
<v Speaker 1>in Windows where a file path is just too long,

135
00:06:45.439 --> 00:06:47.439
<v Speaker 1>that like two hundred and sixty character limit thing?

136
00:06:47.519 --> 00:06:49.519
<v Speaker 2>Oh yeah, super frustrated.

137
00:06:49.560 --> 00:06:52.680
<v Speaker 1>It's a classic Windows headache, isn't it. But PowerShell has

138
00:06:52.720 --> 00:06:53.319
<v Speaker 1>a trick for that.

139
00:06:53.439 --> 00:06:57.680
<v Speaker 2>It does, thankfully, so Windows itself actually supports much much

140
00:06:57.839 --> 00:07:01.959
<v Speaker 2>longer paths, like thirty two thousand characters internally, but lots

141
00:07:02.000 --> 00:07:04.639
<v Speaker 2>of the older tools and APIs, even parts of File

142
00:07:04.680 --> 00:07:07.199
<v Speaker 2>Explorer weren't written to handle them, so they choke on

143
00:07:07.199 --> 00:07:10.199
<v Speaker 2>anything over two sixty. PowerShell lets you work around this

144
00:07:10.319 --> 00:07:13.800
<v Speaker 2>by creating a temporary PowerShell drive using new ps drive.

145
00:07:14.160 --> 00:07:17.160
<v Speaker 2>You map this drive directly to the really long path.

146
00:07:17.279 --> 00:07:19.759
<v Speaker 1>Ah, so it kind of creates a shorter alias.

147
00:07:19.360 --> 00:07:21.839
<v Speaker 2>Exactly, and then you can use that drive letter to

148
00:07:21.879 --> 00:07:25.680
<v Speaker 2>access the files inside, making those previously inaccessible files totally

149
00:07:25.720 --> 00:07:27.759
<v Speaker 2>manageable from PowerShell. It's a clever fix.

150
00:07:28.079 --> 00:07:30.839
<v Speaker 1>And here's another need trick. I came across unblock file.

151
00:07:31.199 --> 00:07:34.040
<v Speaker 1>What's that about? You download something and Windows warns you

152
00:07:34.079 --> 00:07:35.480
<v Speaker 1>it's from the internet.

153
00:07:35.160 --> 00:07:38.480
<v Speaker 2>Right that mark of the web warning that's actually stored

154
00:07:38.519 --> 00:07:41.959
<v Speaker 2>in something called an alternate data stream or ADS attached

155
00:07:41.959 --> 00:07:46.720
<v Speaker 2>to the file, specifically one called zone dot identifier. Unbloged

156
00:07:46.720 --> 00:07:51.560
<v Speaker 2>file simply removes that specific ADS poof the warning is gone.

157
00:07:52.199 --> 00:07:56.160
<v Speaker 1>So PowerShell lets you manipulate these hidden file system features directly.

158
00:07:56.319 --> 00:07:58.360
<v Speaker 2>It does. It gives you that deeper level of control

159
00:07:58.399 --> 00:08:01.519
<v Speaker 2>that's often hidden away. And while we're on files, let's

160
00:08:01.519 --> 00:08:07.480
<v Speaker 2>talk integrity. Verifying files haven't been changed. PowerShell can calculate cryptographic.

161
00:08:06.839 --> 00:08:09.439
<v Speaker 1>Hashes like MB five, SAHA one.

162
00:08:09.560 --> 00:08:13.160
<v Speaker 2>YEP, MD five, SAHA one, and importantly the SAHA two

163
00:08:13.160 --> 00:08:16.480
<v Speaker 2>five six family. There's a handy script often used called

164
00:08:16.560 --> 00:08:19.800
<v Speaker 2>get file hash or similar functionality built in. Now it's

165
00:08:19.800 --> 00:08:20.920
<v Speaker 2>important understand the difference.

166
00:08:20.920 --> 00:08:21.120
<v Speaker 1>Though.

167
00:08:21.240 --> 00:08:23.600
<v Speaker 2>MD five and SAHA one are okay for checking if

168
00:08:23.600 --> 00:08:25.759
<v Speaker 2>a file got corrupted accidentally.

169
00:08:25.279 --> 00:08:27.480
<v Speaker 1>But not if someone tried to tamper with it. Right.

170
00:08:27.959 --> 00:08:31.160
<v Speaker 2>For protecting against intentional tampering, you really need SAHA two

171
00:08:31.160 --> 00:08:34.600
<v Speaker 2>fifixer stronger. It's much harder to create a malicious file

172
00:08:34.679 --> 00:08:37.759
<v Speaker 2>that has the same SAHA two fifty six hash as

173
00:08:37.759 --> 00:08:41.879
<v Speaker 2>a legitimate one critical for checking software downloads, for instance.

174
00:08:41.679 --> 00:08:43.840
<v Speaker 1>Corrupting smart scripts and automating tasks.

175
00:08:43.919 --> 00:08:48.039
<v Speaker 2>Okay, So We've covered interacting manipulating files and data, but

176
00:08:48.799 --> 00:08:53.480
<v Speaker 2>the real magic for many people is automation. Right building scripts.

177
00:08:53.080 --> 00:08:57.240
<v Speaker 1>Absolutely and PowerShell scripts are fundamentally just simple text files,

178
00:08:57.480 --> 00:08:59.519
<v Speaker 1>usually with the PS one extension.

179
00:08:59.159 --> 00:09:01.200
<v Speaker 2>So anything I type in interactively.

180
00:09:01.200 --> 00:09:03.279
<v Speaker 1>You can put into it ot PS one file and

181
00:09:03.440 --> 00:09:05.840
<v Speaker 1>run it again and again. That's the basic idea. But

182
00:09:05.919 --> 00:09:08.960
<v Speaker 1>to make your scripts more robust and reusable, you'll quickly

183
00:09:09.000 --> 00:09:11.759
<v Speaker 1>move to using functions. Functions let you package up a

184
00:09:11.759 --> 00:09:13.919
<v Speaker 1>set of commands, give it a name, and then just

185
00:09:14.000 --> 00:09:16.399
<v Speaker 1>call that name whenever you need that block logic. You

186
00:09:16.399 --> 00:09:18.960
<v Speaker 1>can even control their scope, like is this function only

187
00:09:19.000 --> 00:09:21.960
<v Speaker 1>available inside this script? Or can I use it anywhere

188
00:09:22.120 --> 00:09:23.320
<v Speaker 1>in my PowerShell session?

189
00:09:23.559 --> 00:09:26.879
<v Speaker 2>Right, and for applying custom logic to data as it

190
00:09:26.919 --> 00:09:29.039
<v Speaker 2>flows through that pipeline we talked about.

191
00:09:28.840 --> 00:09:32.320
<v Speaker 1>That's where fourch object is indispensable or it's alias percent.

192
00:09:32.639 --> 00:09:35.120
<v Speaker 1>It lets you take each object coming through the pipe

193
00:09:35.159 --> 00:09:39.120
<v Speaker 1>and do something specific with it. Perform calculations, call other

194
00:09:39.159 --> 00:09:40.279
<v Speaker 1>commands whatever you need.

195
00:09:40.519 --> 00:09:45.360
<v Speaker 2>This sounds incredibly flexible, but what about making these scripts usable?

196
00:09:45.519 --> 00:09:45.639
<v Speaker 1>Like?

197
00:09:45.879 --> 00:09:48.840
<v Speaker 2>If I write a script, how do I add instructions

198
00:09:48.919 --> 00:09:51.399
<v Speaker 2>or explain the parameters? Make it easy for someone else

199
00:09:51.519 --> 00:09:55.480
<v Speaker 2>or even me six months later to understand great question.

200
00:09:55.759 --> 00:09:58.360
<v Speaker 1>PowerShell has a built in system for that, called comment

201
00:09:58.440 --> 00:10:02.200
<v Speaker 1>based help. You write spec comments inside your script using

202
00:10:02.200 --> 00:10:06.399
<v Speaker 1>specific keywords like synopsis, description, parameter, example.

203
00:10:06.080 --> 00:10:06.720
<v Speaker 2>Ah okay.

204
00:10:06.799 --> 00:10:08.960
<v Speaker 1>Then anyone using your script can just type get help

205
00:10:09.399 --> 00:10:13.039
<v Speaker 1>your script dot ps one and they get nicely formatted help,

206
00:10:13.480 --> 00:10:15.120
<v Speaker 1>just like for a built in siliment.

207
00:10:15.000 --> 00:10:17.879
<v Speaker 2>That's brilliant makes your own tools feel much more professional.

208
00:10:17.960 --> 00:10:20.399
<v Speaker 1>It really does. It's a best practice you should adopt.

209
00:10:20.080 --> 00:10:23.279
<v Speaker 2>Early on and thinking about safety, especially if a script

210
00:10:23.320 --> 00:10:26.919
<v Speaker 2>is going to change things delete files, stop services are

211
00:10:26.919 --> 00:10:27.799
<v Speaker 2>their safeguards?

212
00:10:28.080 --> 00:10:33.039
<v Speaker 1>Yes, definitely. PowerShell has what are called common parameters, and

213
00:10:33.120 --> 00:10:35.720
<v Speaker 1>two of the most important for safety are what if

214
00:10:36.200 --> 00:10:36.879
<v Speaker 1>and confirm.

215
00:10:37.399 --> 00:10:40.600
<v Speaker 2>What if does that just show you what would happen exactly.

216
00:10:40.720 --> 00:10:44.320
<v Speaker 1>If the Sambalat developer supported it, and most well written

217
00:10:44.360 --> 00:10:47.960
<v Speaker 1>ones do. Using what if will make the command report

218
00:10:47.960 --> 00:10:50.480
<v Speaker 1>what changes it would make, but it won't actually make them.

219
00:10:50.519 --> 00:10:51.559
<v Speaker 1>It's like a dry.

220
00:10:51.399 --> 00:10:55.399
<v Speaker 2>Run, perfect for testing, and confirm.

221
00:10:55.120 --> 00:10:59.360
<v Speaker 1>Confirm makes PowerShell pause and ask you are you sure yeah?

222
00:11:00.039 --> 00:11:02.960
<v Speaker 1>Forming the action for each item gives you that final chance.

223
00:11:02.759 --> 00:11:04.600
<v Speaker 2>To back out, like a built in safety net.

224
00:11:04.759 --> 00:11:07.720
<v Speaker 1>Precisely, very very useful. Especially when you're starting out or

225
00:11:07.759 --> 00:11:10.480
<v Speaker 1>working with critical systems. That's a key point. And you know,

226
00:11:10.639 --> 00:11:13.080
<v Speaker 1>PowerShell doesn't just live in its own bubble. It lets

227
00:11:13.080 --> 00:11:15.720
<v Speaker 1>you reach out into other core Windows technologies. You're not

228
00:11:15.799 --> 00:11:18.919
<v Speaker 1>limited to just it's built in somemeloans how so well

229
00:11:18.919 --> 00:11:21.200
<v Speaker 1>for starters, you have direct access to the entire dot

230
00:11:21.240 --> 00:11:22.279
<v Speaker 1>net framework.

231
00:11:21.879 --> 00:11:24.399
<v Speaker 2>Which is huge, right, that underlies a lot of Windows.

232
00:11:24.639 --> 00:11:27.879
<v Speaker 1>It's massive, millions of pre built classes and functions for

233
00:11:27.919 --> 00:11:34.000
<v Speaker 1>doing almost anything, advanced math, file operations, networking, cryptography, UI elements,

234
00:11:35.039 --> 00:11:38.480
<v Speaker 1>you name it. If PowerShell doesn't have a cmdallet for

235
00:11:38.559 --> 00:11:41.600
<v Speaker 1>something specific, chances are you can do it using a

236
00:11:41.639 --> 00:11:43.559
<v Speaker 1>dot Net class directly from your script.

237
00:11:43.720 --> 00:11:44.240
<v Speaker 2>Wow.

238
00:11:44.559 --> 00:11:47.759
<v Speaker 1>And beyond dot Net, you can interact with older CAMM objects,

239
00:11:48.080 --> 00:11:50.120
<v Speaker 1>though much of that is less needed now thanks to

240
00:11:50.200 --> 00:11:53.759
<v Speaker 1>native PowerShell features, and you can even get down to

241
00:11:53.799 --> 00:11:57.679
<v Speaker 1>calling low level Windows API functions using a technique called pinvoke,

242
00:11:58.039 --> 00:11:58.360
<v Speaker 1>so you.

243
00:11:58.279 --> 00:12:00.399
<v Speaker 2>Can really bridge almost any gap if you need to.

244
00:12:00.639 --> 00:12:03.320
<v Speaker 1>Pretty much. It makes PowerShell incredibly.

245
00:12:02.799 --> 00:12:05.279
<v Speaker 2>Extensible orchestrating and managing at scale.

246
00:12:05.440 --> 00:12:08.440
<v Speaker 1>Okay, so, once you're comfortable automating things on your own machine,

247
00:12:08.840 --> 00:12:12.000
<v Speaker 1>the next big step is often managing multiple computers, right, okay,

248
00:12:12.120 --> 00:12:14.200
<v Speaker 1>whether it's servers in a business or maybe just a

249
00:12:14.200 --> 00:12:15.320
<v Speaker 1>few PCs at home.

250
00:12:15.279 --> 00:12:18.960
<v Speaker 2>Exactly, And that's where PowerShell remoting becomes incredibly powerful.

251
00:12:18.960 --> 00:12:20.120
<v Speaker 1>How does that work basically?

252
00:12:20.360 --> 00:12:23.120
<v Speaker 2>Well, first you need to enable it on the target machines,

253
00:12:23.200 --> 00:12:26.720
<v Speaker 2>usually with a command like enable ps remoting. It sets

254
00:12:26.799 --> 00:12:31.120
<v Speaker 2>up the necessary firewall rules and services securely. Once that's done,

255
00:12:31.240 --> 00:12:33.480
<v Speaker 2>you have a couple of main ways to interact remotely.

256
00:12:33.639 --> 00:12:34.480
<v Speaker 1>Okay.

257
00:12:34.559 --> 00:12:37.919
<v Speaker 2>You can use enter ps session computer name. This drops

258
00:12:37.960 --> 00:12:40.919
<v Speaker 2>you into an interactive session on the remote machine. It

259
00:12:40.960 --> 00:12:44.159
<v Speaker 2>feels almost exactly like you're sitting right there typing at

260
00:12:44.200 --> 00:12:45.080
<v Speaker 2>its local console.

261
00:12:45.200 --> 00:12:47.399
<v Speaker 1>So it's like SSH but for PowerShell.

262
00:12:47.679 --> 00:12:52.120
<v Speaker 2>Very similar concept, yes. Or for running commands non interactively,

263
00:12:52.360 --> 00:12:55.679
<v Speaker 2>especially on many machines at once, you use invoke command

264
00:12:55.799 --> 00:12:58.360
<v Speaker 2>Invoke command right, You give it a list of computer

265
00:12:58.440 --> 00:13:00.960
<v Speaker 2>names and a script block commands you want to run,

266
00:13:01.159 --> 00:13:03.840
<v Speaker 2>and it executes them in parallel on all those machines

267
00:13:03.879 --> 00:13:04.440
<v Speaker 2>in parallel.

268
00:13:04.440 --> 00:13:06.440
<v Speaker 1>That sounds efficient, hugely efficient.

269
00:13:06.679 --> 00:13:09.840
<v Speaker 2>You can control how many runs simultaneously with throttle limit

270
00:13:10.039 --> 00:13:11.919
<v Speaker 2>and even run. The whole thing is a background job

271
00:13:12.000 --> 00:13:14.399
<v Speaker 2>using as jobs, so your local console isn't tied.

272
00:13:14.240 --> 00:13:16.639
<v Speaker 1>Up and I read something about import pa session. That

273
00:13:16.679 --> 00:13:17.519
<v Speaker 1>sounds intriguing.

274
00:13:17.879 --> 00:13:22.399
<v Speaker 2>Ah, yes, that's a really clever future. Imagine a remote

275
00:13:22.440 --> 00:13:26.320
<v Speaker 2>server has some special PowerShell module installed with commands you need,

276
00:13:26.480 --> 00:13:29.480
<v Speaker 2>but you don't have it locally. You establish a session

277
00:13:29.519 --> 00:13:34.120
<v Speaker 2>to that server, then use import PA session. PowerShell implicitly

278
00:13:34.159 --> 00:13:37.120
<v Speaker 2>brings those remote commands into your local session.

279
00:13:37.000 --> 00:13:39.399
<v Speaker 1>So they just appear like local commands exactly.

280
00:13:40.039 --> 00:13:43.799
<v Speaker 2>When you run one, PowerShell transparently sends the command back

281
00:13:43.840 --> 00:13:47.759
<v Speaker 2>to the original remote machine for execution and returns the results.

282
00:13:48.399 --> 00:13:52.240
<v Speaker 2>It makes managing specialized remote systems feel seamless. Now, for

283
00:13:52.480 --> 00:13:56.320
<v Speaker 2>really complex, long running tasks, maybe something that involves coordinating

284
00:13:56.320 --> 00:13:59.279
<v Speaker 2>steps across multiple machines and needs to survive reboots or

285
00:13:59.360 --> 00:14:03.799
<v Speaker 2>network interrupts, PowerShell offers something called workflows.

286
00:14:04.200 --> 00:14:06.679
<v Speaker 1>Workflows all right, how are they different from regular scripts.

287
00:14:06.720 --> 00:14:09.559
<v Speaker 2>They're built on a different engine, the Windows Workflow foundation.

288
00:14:10.080 --> 00:14:14.039
<v Speaker 2>They're specifically designed for orchestration and resilience. Think of tasks

289
00:14:14.080 --> 00:14:17.200
<v Speaker 2>like provisioning a new server, which involves multiple steps, some

290
00:14:17.399 --> 00:14:20.720
<v Speaker 2>potentially slow, maybe on different machines. A workflow can manage

291
00:14:20.720 --> 00:14:23.559
<v Speaker 2>that entire process, and if it gets interrupted halfway through,

292
00:14:23.600 --> 00:14:25.240
<v Speaker 2>it can often resume where it left off.

293
00:14:25.519 --> 00:14:28.840
<v Speaker 1>Okay, that sounds useful for complex automation. And within these

294
00:14:28.879 --> 00:14:30.679
<v Speaker 1>workflows you can run things in parallel.

295
00:14:30.879 --> 00:14:34.200
<v Speaker 2>Yes, you can define parallel blocks, so if you need

296
00:14:34.279 --> 00:14:38.720
<v Speaker 2>to say, copy large log files from several servers simultaneously

297
00:14:38.799 --> 00:14:43.159
<v Speaker 2>before processing them, a workflow can handle that concurrent execution easily.

298
00:14:43.320 --> 00:14:46.200
<v Speaker 1>And can you still use regular PowerShell commands inside them?

299
00:14:46.320 --> 00:14:49.600
<v Speaker 2>You can, yes, within special inline script blocks, so you

300
00:14:49.639 --> 00:14:52.679
<v Speaker 2>get the robustness of the workflow engine plus the flexibility

301
00:14:52.679 --> 00:14:57.200
<v Speaker 2>of standard PowerShell scripting. Now shifting slightly. When we talk

302
00:14:57.200 --> 00:15:00.840
<v Speaker 2>about robustness and IT systems, the concept of tr transactions

303
00:15:00.879 --> 00:15:02.120
<v Speaker 2>often comes up right.

304
00:15:02.039 --> 00:15:05.600
<v Speaker 1>Like with databases or bank transfers, either everything succeeds or

305
00:15:05.639 --> 00:15:06.200
<v Speaker 1>nothing does.

306
00:15:06.559 --> 00:15:12.399
<v Speaker 2>Atomicity exactly that principle ensuring consistency. Powershall actually supports transactions,

307
00:15:12.480 --> 00:15:16.279
<v Speaker 2>primarily for managing the Windows registry, but potentially other things too.

308
00:15:16.679 --> 00:15:19.679
<v Speaker 2>You use start transaction to begin a transaction block, then

309
00:15:20.000 --> 00:15:22.879
<v Speaker 2>any cmittle it's you run with the dead use transaction

310
00:15:22.960 --> 00:15:24.200
<v Speaker 2>parameter are part of.

311
00:15:24.159 --> 00:15:25.799
<v Speaker 1>That transaction, and then something goes wrong.

312
00:15:26.000 --> 00:15:29.480
<v Speaker 2>If an error occurs, or if you explicitly call undue transaction,

313
00:15:30.080 --> 00:15:33.399
<v Speaker 2>all the changes made within that transaction are automatically rolled back.

314
00:15:34.000 --> 00:15:37.120
<v Speaker 2>The registry or other transactional resource is left exactly as

315
00:15:37.120 --> 00:15:38.200
<v Speaker 2>it was before you start it.

316
00:15:38.200 --> 00:15:40.200
<v Speaker 1>So you can guarantee a set of changes either all

317
00:15:40.200 --> 00:15:42.360
<v Speaker 1>complete or none of them take effect precisely.

318
00:15:42.440 --> 00:15:46.519
<v Speaker 2>It's key for maintaining system integrity during complex configuration changes.

319
00:15:46.720 --> 00:15:51.240
<v Speaker 1>And finally, one more advanced topic, making scripts react to

320
00:15:51.279 --> 00:15:52.480
<v Speaker 1>things happening on the system.

321
00:15:53.120 --> 00:15:57.120
<v Speaker 2>Event handling, Yes, power shall provides a really unified way

322
00:15:57.120 --> 00:16:00.000
<v Speaker 2>to handle system events. This could be dot net events,

323
00:16:00.399 --> 00:16:03.799
<v Speaker 2>WMI events, which cover a huge range of system activities

324
00:16:03.840 --> 00:16:08.279
<v Speaker 2>like services, stopping processes, starting hardware changes, or even custom

325
00:16:08.320 --> 00:16:10.120
<v Speaker 2>events your own scripts generate.

326
00:16:10.240 --> 00:16:13.879
<v Speaker 1>So my script could automatically trigger when, say, a specific

327
00:16:13.919 --> 00:16:16.440
<v Speaker 1>service stops unexpectedly.

328
00:16:15.960 --> 00:16:19.200
<v Speaker 2>Exactly you register an event subscription using register object event

329
00:16:19.320 --> 00:16:22.919
<v Speaker 2>or register WIMI event, specifying the event you're interested in,

330
00:16:22.960 --> 00:16:25.879
<v Speaker 2>and action a script block to run when that event fires.

331
00:16:26.000 --> 00:16:29.600
<v Speaker 1>That opens up possibilities for really dynamic, responsive administration.

332
00:16:30.000 --> 00:16:32.080
<v Speaker 2>It really does you move from just running scripts on

333
00:16:32.120 --> 00:16:35.720
<v Speaker 2>a schedule to having scripts intelligently react to the state

334
00:16:35.759 --> 00:16:39.240
<v Speaker 2>of the system in real time. HASHTAGA, hashtag out trip.

335
00:16:39.799 --> 00:16:42.559
<v Speaker 1>So after all that, what does this really mean for you?

336
00:16:42.600 --> 00:16:45.720
<v Speaker 1>The listener? The informed digital citizens? We talked about We've

337
00:16:46.240 --> 00:16:48.799
<v Speaker 1>only really scratched the surface of what Windows PowerShell can do,

338
00:16:49.200 --> 00:16:51.799
<v Speaker 1>but hopefully you've seen it's way more than just a

339
00:16:51.840 --> 00:16:55.480
<v Speaker 1>fanci or command prompt. From its core object oriented nature

340
00:16:55.480 --> 00:16:58.440
<v Speaker 1>that just simplifies everything to its amazing remoting and workflow

341
00:16:58.440 --> 00:17:02.399
<v Speaker 1>stuff for managing things at scale, PowerShell is this deeply integrated,

342
00:17:02.480 --> 00:17:05.799
<v Speaker 1>super adaptable tool. It helps you automate, manage, and genuinely

343
00:17:05.920 --> 00:17:08.920
<v Speaker 1>understand your Windows environment much better. It really feels like

344
00:17:08.920 --> 00:17:12.039
<v Speaker 1>a shortcut to being well, incredibly capable and efficient.

345
00:17:12.359 --> 00:17:14.839
<v Speaker 2>Yeah, and that really raises an important question for you,

346
00:17:14.880 --> 00:17:17.799
<v Speaker 2>doesn't it. How will you start using this? How will

347
00:17:17.839 --> 00:17:21.319
<v Speaker 2>you begin applying some of this power? Maybe just by

348
00:17:21.319 --> 00:17:25.000
<v Speaker 2>playing with the discovery commands we mentioned, get command, dash

349
00:17:25.079 --> 00:17:27.680
<v Speaker 2>verb get to see all the things you can get

350
00:17:27.960 --> 00:17:31.160
<v Speaker 2>or get help, get process full to really dig into

351
00:17:31.240 --> 00:17:34.839
<v Speaker 2>one command, or maybe pipe some command output into outgridview.

352
00:17:35.200 --> 00:17:38.480
<v Speaker 2>That's a fantastic way to visually explore the rich object

353
00:17:38.559 --> 00:17:39.519
<v Speaker 2>data we've been talking about.

354
00:17:39.599 --> 00:17:40.920
<v Speaker 1>Oh yeah, outgrid to you is great.

355
00:17:41.079 --> 00:17:44.240
<v Speaker 2>Remember, getting PowerShell is partly a shift in mindset. It's

356
00:17:44.240 --> 00:17:47.160
<v Speaker 2>moving from thinking about text to thinking about structured objects

357
00:17:47.519 --> 00:17:50.759
<v Speaker 2>and making that shift that's what unlocks the immense power

358
00:17:50.759 --> 00:17:51.240
<v Speaker 2>it offers.

359
00:17:51.400 --> 00:17:54.119
<v Speaker 1>We definitely encourage you to experiment try out some of

360
00:17:54.160 --> 00:17:57.000
<v Speaker 1>the commands we mentioned today. See for yourself how PowerShell

361
00:17:57.079 --> 00:18:00.920
<v Speaker 1>can really transform how you approach, manage your digital world.

362
00:18:01.160 --> 00:18:03.359
<v Speaker 1>Until next time, keep learning and keep exploring.
