WEBVTT

1
00:00:00.160 --> 00:00:02.759
<v Speaker 1>Welcome to the deep dive. Looks like we're diving into

2
00:00:02.759 --> 00:00:05.519
<v Speaker 1>the world of PowerShell today. Yeah, you want to learn

3
00:00:05.559 --> 00:00:08.480
<v Speaker 1>how to use it to automate all those tedious tasks

4
00:00:08.480 --> 00:00:11.039
<v Speaker 1>you have to do in Windows. And we've got some

5
00:00:11.080 --> 00:00:12.560
<v Speaker 1>great resources to guide us.

6
00:00:12.679 --> 00:00:13.039
<v Speaker 2>Yeah.

7
00:00:13.080 --> 00:00:17.760
<v Speaker 1>Absolutely, We've got excerpts from PowerShell for Sissedminds by Adam

8
00:00:17.800 --> 00:00:22.280
<v Speaker 1>Bertram and some intriguing info from the No Starch Press catalog.

9
00:00:22.559 --> 00:00:23.000
<v Speaker 2>Nice.

10
00:00:23.320 --> 00:00:27.679
<v Speaker 1>So, are you ready to unlock the power of PowerShell

11
00:00:27.800 --> 00:00:29.160
<v Speaker 1>and boost your efficiency?

12
00:00:29.559 --> 00:00:33.479
<v Speaker 2>Absolutely, let's dive in. PowerShell is really a game changer. Okay.

13
00:00:33.679 --> 00:00:38.280
<v Speaker 2>Imagine controlling your systems with code, automating all those boring,

14
00:00:38.320 --> 00:00:42.799
<v Speaker 2>repetitive tasks, and even managing renote computers. Oh wow, all

15
00:00:42.840 --> 00:00:44.000
<v Speaker 2>from one central place.

16
00:00:44.079 --> 00:00:47.960
<v Speaker 1>That sounds amazing, especially for someone like me, always looking

17
00:00:48.000 --> 00:00:50.240
<v Speaker 1>for ways to be more efficient and to save a

18
00:00:50.280 --> 00:00:52.320
<v Speaker 1>little bit of time. Of course, now, one thing that

19
00:00:52.439 --> 00:00:55.240
<v Speaker 1>really caught my eye in the book was that PowerShell

20
00:00:55.359 --> 00:00:58.359
<v Speaker 1>was designed to be user friendly, absolutely, even for people

21
00:00:58.359 --> 00:01:00.920
<v Speaker 1>who aren't you know, hardcore programmers.

22
00:01:01.039 --> 00:01:03.679
<v Speaker 2>It was built for sissigments from the ground up.

23
00:01:04.079 --> 00:01:07.000
<v Speaker 1>And is that because of features like tab completion. I

24
00:01:07.000 --> 00:01:08.439
<v Speaker 1>saw that mention in there, tab.

25
00:01:08.280 --> 00:01:09.879
<v Speaker 2>Completion is a life saver.

26
00:01:10.120 --> 00:01:10.400
<v Speaker 1>Okay.

27
00:01:10.599 --> 00:01:15.120
<v Speaker 2>Instead of memorizing every single command in every parameter, you

28
00:01:15.120 --> 00:01:19.040
<v Speaker 2>can just type part of it, okay, and powershow will

29
00:01:19.040 --> 00:01:21.719
<v Speaker 2>try to predict what you need. Oh nice, especially when

30
00:01:21.760 --> 00:01:25.519
<v Speaker 2>you're working with longer commands or more complex scripts later on.

31
00:01:25.680 --> 00:01:28.000
<v Speaker 1>Yeah, that's going to come in handy definitely. Okay. So

32
00:01:28.079 --> 00:01:30.959
<v Speaker 1>tab completion, Yeah, definitely makes it less intimidating. Sure, so

33
00:01:31.000 --> 00:01:34.400
<v Speaker 1>that's great. Now. Another thing I kept seeing was that

34
00:01:34.439 --> 00:01:37.439
<v Speaker 1>in PowerShell everything is an object.

35
00:01:37.640 --> 00:01:38.680
<v Speaker 2>Everything's an object?

36
00:01:38.680 --> 00:01:39.680
<v Speaker 1>What does that even mean?

37
00:01:40.040 --> 00:01:42.640
<v Speaker 2>It's a little bit of a mind shift, but once

38
00:01:42.680 --> 00:01:47.719
<v Speaker 2>you grasp that concept, it really unlocks the logic of PowerShell. Okay,

39
00:01:48.000 --> 00:01:51.680
<v Speaker 2>think of it this way. Even a simple string of text, Yeah,

40
00:01:52.079 --> 00:01:54.799
<v Speaker 2>like the word blue, that's not just text in Power Show.

41
00:01:55.280 --> 00:01:56.400
<v Speaker 2>It's a string object.

42
00:01:56.519 --> 00:02:00.239
<v Speaker 1>So it's more than just the letters b lue exactly.

43
00:02:00.280 --> 00:02:03.680
<v Speaker 2>It has properties like its length, which tells you how

44
00:02:03.680 --> 00:02:07.480
<v Speaker 2>many characters are in the string, and it also has methods,

45
00:02:08.080 --> 00:02:11.919
<v Speaker 2>which are basically actions that you can perform on that strength.

46
00:02:12.000 --> 00:02:16.000
<v Speaker 1>So, for example, could I use a method to change

47
00:02:16.039 --> 00:02:18.479
<v Speaker 1>that string to all upper case?

48
00:02:18.680 --> 00:02:23.120
<v Speaker 2>You absolutely could? Okay, there's a method called two upper Okay, Specifically,

49
00:02:23.120 --> 00:02:23.960
<v Speaker 2>for that.

50
00:02:23.960 --> 00:02:27.400
<v Speaker 1>That makes sense. Yeah, but how would I know what

51
00:02:27.520 --> 00:02:28.759
<v Speaker 1>properties and methods?

52
00:02:28.879 --> 00:02:31.520
<v Speaker 2>That's where your new best friend comes in. Okay, get

53
00:02:31.560 --> 00:02:34.520
<v Speaker 2>member member. You can use this command on any object

54
00:02:34.960 --> 00:02:36.759
<v Speaker 2>to see all of its properties in methods.

55
00:02:36.840 --> 00:02:39.319
<v Speaker 1>Get members like it's like an X ray for a

56
00:02:39.319 --> 00:02:42.120
<v Speaker 1>PowerShell object. I like that. Get member goes in the

57
00:02:42.159 --> 00:02:46.520
<v Speaker 1>toolbox absolutely. Now. The book also talks about A rays. Yes,

58
00:02:46.599 --> 00:02:50.319
<v Speaker 1>and A ray lists are those related to this whole

59
00:02:50.400 --> 00:02:51.800
<v Speaker 1>object's concept.

60
00:02:52.080 --> 00:02:54.840
<v Speaker 2>They are? Okay, so once you start working with more

61
00:02:54.879 --> 00:02:58.919
<v Speaker 2>than one object, you need a way to organize them, okay, right.

62
00:02:59.080 --> 00:03:02.280
<v Speaker 2>A rays are basically containers. They can hold a fixed

63
00:03:02.360 --> 00:03:03.080
<v Speaker 2>number of objects.

64
00:03:03.159 --> 00:03:05.639
<v Speaker 1>So if I have like a list of usernames, put

65
00:03:05.639 --> 00:03:07.240
<v Speaker 1>those in an array exactly.

66
00:03:07.560 --> 00:03:11.080
<v Speaker 2>Now. If you're dealing with much larger sets of data,

67
00:03:11.479 --> 00:03:15.400
<v Speaker 2>array lists are even better. They can grow dynamically, so

68
00:03:15.439 --> 00:03:17.960
<v Speaker 2>you don't have to preset the size.

69
00:03:18.199 --> 00:03:23.639
<v Speaker 1>Got it. So arrays for smaller fixed sets of data,

70
00:03:23.759 --> 00:03:26.840
<v Speaker 1>arraylists for larger dynamic data sets.

71
00:03:26.879 --> 00:03:29.000
<v Speaker 2>It's all about choosing the right tool for the job.

72
00:03:29.000 --> 00:03:32.599
<v Speaker 1>It is, right, Yeah, okay, cool, So far everything seems

73
00:03:32.840 --> 00:03:36.280
<v Speaker 1>pretty straightforward. But I know we're just scratching the surface here.

74
00:03:36.400 --> 00:03:37.599
<v Speaker 1>Oh yeah, what's next?

75
00:03:37.599 --> 00:03:41.159
<v Speaker 2>On the agenda, let's talk about scripting. Okay, this is

76
00:03:41.199 --> 00:03:45.080
<v Speaker 2>where you can really start automating more complex tasks. But

77
00:03:45.199 --> 00:03:46.960
<v Speaker 2>before we get into that, yeah, we need to talk

78
00:03:47.000 --> 00:03:48.840
<v Speaker 2>about something called execution policies.

79
00:03:49.280 --> 00:03:52.080
<v Speaker 1>Execution policies, Yes, what are those all about?

80
00:03:52.560 --> 00:03:53.719
<v Speaker 2>They're all about security.

81
00:03:53.919 --> 00:03:54.319
<v Speaker 1>Okay.

82
00:03:54.479 --> 00:03:59.599
<v Speaker 2>So execution policies control what kind of PowerShell scripts can

83
00:03:59.639 --> 00:04:03.400
<v Speaker 2>actually be run on your system. There are different levels

84
00:04:03.400 --> 00:04:07.120
<v Speaker 2>of restriction, so some policies might prevent you from running

85
00:04:07.120 --> 00:04:09.080
<v Speaker 2>scripts downloaded from the internet.

86
00:04:08.800 --> 00:04:10.400
<v Speaker 1>Right for security reasons exactly.

87
00:04:10.879 --> 00:04:14.800
<v Speaker 2>There's a policy called restricted which does exactly that, and

88
00:04:14.800 --> 00:04:18.240
<v Speaker 2>that's actually the default on many systems, just to prevent

89
00:04:18.480 --> 00:04:22.639
<v Speaker 2>you know, yeah, accidentally running something that could be harmful.

90
00:04:23.279 --> 00:04:23.800
<v Speaker 1>Makes sense.

91
00:04:24.399 --> 00:04:26.240
<v Speaker 2>Now there are other policies.

92
00:04:25.759 --> 00:04:26.879
<v Speaker 1>Too, Okay, what are those.

93
00:04:27.680 --> 00:04:32.120
<v Speaker 2>All Signed only allows you to run scripts if they've

94
00:04:32.120 --> 00:04:36.040
<v Speaker 2>been digitally signed by a trusted source, got it and

95
00:04:36.160 --> 00:04:40.000
<v Speaker 2>remote signed, unless you run your own scripts and any

96
00:04:40.040 --> 00:04:41.240
<v Speaker 2>sigence scripts you download.

97
00:04:41.439 --> 00:04:44.800
<v Speaker 1>Okay, So that's kind of a balance between security and

98
00:04:45.079 --> 00:04:48.480
<v Speaker 1>flexibility exactly. So it sounds like I need to understand

99
00:04:48.519 --> 00:04:51.560
<v Speaker 1>these execution policies you do to make sure I can

100
00:04:51.639 --> 00:04:55.279
<v Speaker 1>run the scripts that I want to run, exactly. Okay,

101
00:04:55.319 --> 00:04:59.600
<v Speaker 1>and then to actually help me write and manage those scripts. Yes,

102
00:05:00.000 --> 00:05:01.879
<v Speaker 1>book introduces the PowerShell.

103
00:05:02.040 --> 00:05:04.360
<v Speaker 2>I yes, the PowerShell is.

104
00:05:04.399 --> 00:05:05.600
<v Speaker 1>What does I stand for?

105
00:05:05.720 --> 00:05:09.800
<v Speaker 2>It stands for Integrated Scripting Environment, basically a code editor

106
00:05:10.279 --> 00:05:15.279
<v Speaker 2>designed specifically for PowerShell. It has features like syntax highlighting

107
00:05:15.399 --> 00:05:21.120
<v Speaker 2>okay to help you write error free code, and debugging

108
00:05:21.160 --> 00:05:24.839
<v Speaker 2>tools to help you troubleshoot your scripts when things.

109
00:05:24.680 --> 00:05:28.040
<v Speaker 1>Go wrong, which they inevitably will of course, So this

110
00:05:28.120 --> 00:05:30.120
<v Speaker 1>sounds like this will be really helpful.

111
00:05:30.160 --> 00:05:31.040
<v Speaker 2>It'll help you a lot.

112
00:05:31.000 --> 00:05:33.040
<v Speaker 1>Once I start getting into more complex scripting.

113
00:05:33.279 --> 00:05:33.959
<v Speaker 2>Absolutely.

114
00:05:34.199 --> 00:05:37.560
<v Speaker 1>Okay. So we've covered the console, I've talked about objects,

115
00:05:37.759 --> 00:05:39.920
<v Speaker 1>We've even touched on security a bit, a little bit.

116
00:05:40.199 --> 00:05:42.120
<v Speaker 1>Now I'm ready to dive into the scripting thing.

117
00:05:42.800 --> 00:05:45.800
<v Speaker 2>Scripting is where the real magic happens. And the best

118
00:05:45.800 --> 00:05:50.319
<v Speaker 2>part is PowerShell was built on this principle of don't

119
00:05:50.439 --> 00:05:53.680
<v Speaker 2>repeat yourself. Okay, So it's all about automation.

120
00:05:53.839 --> 00:05:57.120
<v Speaker 1>I love that. I love that principle. So what are

121
00:05:57.160 --> 00:06:00.560
<v Speaker 1>some of the key concepts I need to know to

122
00:06:00.680 --> 00:06:04.079
<v Speaker 1>start writing these effective PowerShell scripts?

123
00:06:04.399 --> 00:06:08.240
<v Speaker 2>Control flow statements, control flow states. These are your building blocks, Okay.

124
00:06:08.439 --> 00:06:11.879
<v Speaker 2>They allow you to create scripts that make decisions okay,

125
00:06:11.920 --> 00:06:13.680
<v Speaker 2>and adapt to different situations.

126
00:06:13.879 --> 00:06:15.399
<v Speaker 1>So it's like a choose your own adventure.

127
00:06:15.439 --> 00:06:17.600
<v Speaker 2>It's like to choose your own adventures for your computer.

128
00:06:17.839 --> 00:06:21.240
<v Speaker 1>Okay, I'm intrigued. Yeah, tell me more about these control

129
00:06:21.279 --> 00:06:23.160
<v Speaker 1>flow statements. What does they look like?

130
00:06:23.399 --> 00:06:28.360
<v Speaker 2>Well, you have flightful statements okay, which lets you perform

131
00:06:28.399 --> 00:06:33.920
<v Speaker 2>different actions based on certain conditions. So, for example, imagine

132
00:06:33.959 --> 00:06:36.839
<v Speaker 2>you want to write a script that checks the free

133
00:06:36.839 --> 00:06:39.600
<v Speaker 2>space on your hard drive. Okay, you could use an

134
00:06:39.600 --> 00:06:42.240
<v Speaker 2>if statement to check if the free space is below

135
00:06:42.279 --> 00:06:45.000
<v Speaker 2>a certain threshold, right, and then send you an alert

136
00:06:45.040 --> 00:06:45.480
<v Speaker 2>if it is.

137
00:06:46.040 --> 00:06:49.199
<v Speaker 1>Oh, that's useful. Yeah, I can already see how that

138
00:06:49.279 --> 00:06:49.800
<v Speaker 1>would be.

139
00:06:49.720 --> 00:06:52.040
<v Speaker 2>Helpful practical example. Yeah. Yeah.

140
00:06:52.560 --> 00:06:56.480
<v Speaker 1>What other kinds of control flow statements are there?

141
00:06:56.839 --> 00:07:00.639
<v Speaker 2>They're also switch statements, okay, which can be more efficient

142
00:07:01.279 --> 00:07:04.720
<v Speaker 2>than a bunch of IF statements if you're checking against

143
00:07:04.800 --> 00:07:06.199
<v Speaker 2>multiple possible values.

144
00:07:06.480 --> 00:07:10.600
<v Speaker 1>So if statements for simple conditions, which statements for multiple conditions?

145
00:07:10.600 --> 00:07:11.120
<v Speaker 2>Exactly?

146
00:07:11.279 --> 00:07:11.639
<v Speaker 3>Got it?

147
00:07:12.199 --> 00:07:16.199
<v Speaker 1>What about repeating actions, like if I wanted to perform

148
00:07:16.319 --> 00:07:19.519
<v Speaker 1>the same task but on multiple files.

149
00:07:20.079 --> 00:07:21.279
<v Speaker 2>That's where loops come in.

150
00:07:21.680 --> 00:07:22.000
<v Speaker 1>Okay.

151
00:07:22.160 --> 00:07:26.959
<v Speaker 2>PowerShell has several types of loops, like for each wile.

152
00:07:27.600 --> 00:07:32.240
<v Speaker 2>Each loop has its own unique way of repeating actions

153
00:07:32.279 --> 00:07:33.680
<v Speaker 2>based on certain conditions.

154
00:07:34.000 --> 00:07:38.079
<v Speaker 1>So with loops, I could write a script that would

155
00:07:38.120 --> 00:07:42.199
<v Speaker 1>go through every file and a folder and perform some action.

156
00:07:42.519 --> 00:07:46.959
<v Speaker 2>On each one exactly. You could rename them, move them.

157
00:07:47.040 --> 00:07:48.959
<v Speaker 1>Or whatever I want, compress them, got.

158
00:07:48.879 --> 00:07:50.879
<v Speaker 2>It, whatever you can imagine.

159
00:07:51.079 --> 00:07:55.000
<v Speaker 1>This is starting to feel powerful, it is. Okay, So

160
00:07:55.040 --> 00:07:58.279
<v Speaker 1>we've got these conditional statements like if and switch, we've

161
00:07:58.319 --> 00:08:02.199
<v Speaker 1>got loops for repeating actions. Absolutely anything else I need

162
00:08:02.279 --> 00:08:03.319
<v Speaker 1>to know about control flow.

163
00:08:03.800 --> 00:08:06.959
<v Speaker 2>One more crucial thing, okay, error handling.

164
00:08:07.319 --> 00:08:08.000
<v Speaker 1>Error handling.

165
00:08:08.040 --> 00:08:11.600
<v Speaker 2>What happens when something unexpected happens in your script?

166
00:08:11.680 --> 00:08:11.839
<v Speaker 3>Oh?

167
00:08:11.879 --> 00:08:13.480
<v Speaker 1>Yeah, of course things are going to go wrong.

168
00:08:14.439 --> 00:08:18.600
<v Speaker 2>PowerShell has ways to handle those situations gracefully. Okay, so

169
00:08:18.639 --> 00:08:20.120
<v Speaker 2>your script doesn't just crash and burn.

170
00:08:20.240 --> 00:08:23.439
<v Speaker 1>Okay, good error handling. I can see why that.

171
00:08:23.360 --> 00:08:26.600
<v Speaker 2>Would be important, especially if your scripts are running critical tasks.

172
00:08:26.800 --> 00:08:29.759
<v Speaker 2>You don't want them to just fall apart. So PowerShell

173
00:08:30.319 --> 00:08:33.679
<v Speaker 2>uses these things called exceptions and errors to deal with

174
00:08:33.799 --> 00:08:38.759
<v Speaker 2>these unexpected situations, and learning how to anticipate and manage

175
00:08:38.840 --> 00:08:44.000
<v Speaker 2>those errors is really key. Got it to writing robust

176
00:08:44.120 --> 00:08:45.399
<v Speaker 2>and reliable scripts.

177
00:08:45.519 --> 00:08:50.360
<v Speaker 1>So control flow statements, loops, and error handling error handling.

178
00:08:50.399 --> 00:08:51.279
<v Speaker 1>Those are the foundation.

179
00:08:51.360 --> 00:08:53.600
<v Speaker 2>Those are your foundations for scripting.

180
00:08:53.759 --> 00:08:54.120
<v Speaker 3>Got it.

181
00:08:54.320 --> 00:08:54.720
<v Speaker 2>Yeah.

182
00:08:54.879 --> 00:08:57.600
<v Speaker 1>Once I understand those, I'm well on my way.

183
00:08:57.759 --> 00:08:59.120
<v Speaker 2>You're well on your way to.

184
00:08:59.200 --> 00:09:01.840
<v Speaker 1>Writing some seriously powerful scripts.

185
00:09:01.879 --> 00:09:02.440
<v Speaker 2>Absolutely.

186
00:09:02.639 --> 00:09:05.480
<v Speaker 1>I can't wait to start putting this all into practice.

187
00:09:05.759 --> 00:09:08.600
<v Speaker 1>Is there anything else we should cover before we move on?

188
00:09:08.519 --> 00:09:10.840
<v Speaker 1>One more thing to some real world examples.

189
00:09:10.919 --> 00:09:13.159
<v Speaker 2>Let's talk about functions and modules.

190
00:09:13.200 --> 00:09:14.519
<v Speaker 1>Functions and modules.

191
00:09:14.519 --> 00:09:18.639
<v Speaker 2>This is a building blocks for organizing and reusing your

192
00:09:18.679 --> 00:09:22.799
<v Speaker 2>PowerShell code. Okay, think of them like pre build components

193
00:09:23.399 --> 00:09:26.720
<v Speaker 2>that you can assemble to create more complex scripts.

194
00:09:26.879 --> 00:09:30.200
<v Speaker 1>Sounds intriguing. Tell me more about functions and modules.

195
00:09:30.240 --> 00:09:33.600
<v Speaker 2>So functions are like mini programs okay, within your script.

196
00:09:34.159 --> 00:09:38.120
<v Speaker 2>They let you group together reusable blocks of code, which

197
00:09:38.200 --> 00:09:43.320
<v Speaker 2>makes your scripts more organized, more readable, and easier to test.

198
00:09:43.600 --> 00:09:46.720
<v Speaker 2>Got it, and to keep things clear? Yeah. The book

199
00:09:46.759 --> 00:09:51.759
<v Speaker 2>really emphasizes giving your functions descriptive names, using what's called

200
00:09:51.799 --> 00:09:53.600
<v Speaker 2>the verb noun convention.

201
00:09:53.360 --> 00:09:55.039
<v Speaker 1>Verb noun convention. Yes, what is that?

202
00:09:55.120 --> 00:09:57.679
<v Speaker 2>It's a simple way to name your functions so that

203
00:09:57.759 --> 00:10:01.519
<v Speaker 2>they clearly describe what they do. Sample. Instead of naming

204
00:10:01.519 --> 00:10:05.080
<v Speaker 2>a function like processed data, you might have a function

205
00:10:05.159 --> 00:10:09.000
<v Speaker 2>called get user data or set file permissions.

206
00:10:09.039 --> 00:10:11.000
<v Speaker 1>Okay, so the verb comes first.

207
00:10:10.799 --> 00:10:12.840
<v Speaker 2>Verb first, and then the noun and then the noun.

208
00:10:13.120 --> 00:10:14.200
<v Speaker 1>That makes perfect sense.

209
00:10:14.320 --> 00:10:16.919
<v Speaker 2>It makes it much easier to understand what the function

210
00:10:17.000 --> 00:10:19.039
<v Speaker 2>does exactly just by looking at its name.

211
00:10:19.399 --> 00:10:23.399
<v Speaker 1>Yeah, descriptive names are always good, absolutely. So what about module?

212
00:10:23.679 --> 00:10:28.200
<v Speaker 2>Modules are basically containers for your functions. They let you

213
00:10:28.279 --> 00:10:31.559
<v Speaker 2>bundle a bunch of related functions together so you can

214
00:10:31.600 --> 00:10:35.559
<v Speaker 2>share them and reuse them easily. Imagine you have a

215
00:10:35.600 --> 00:10:39.759
<v Speaker 2>set of functions for managing user accounts. You can put

216
00:10:39.799 --> 00:10:43.799
<v Speaker 2>all those functions together in a module called user Management.

217
00:10:44.000 --> 00:10:45.039
<v Speaker 1>So it's like a library.

218
00:10:45.159 --> 00:10:48.039
<v Speaker 2>It's like a library, a reusable PowerShell code.

219
00:10:48.279 --> 00:10:52.480
<v Speaker 1>Okay, Yeah, that's a brilliant way to organize things. It is,

220
00:10:52.519 --> 00:10:55.440
<v Speaker 1>and not have to reinvent the wheel every time you

221
00:10:55.559 --> 00:10:57.799
<v Speaker 1>need to do a common task.

222
00:10:57.960 --> 00:11:01.080
<v Speaker 2>Don't repeat yourself, right exactly. And you can even share

223
00:11:01.120 --> 00:11:04.679
<v Speaker 2>your modules with others. Oh wow, download modules and other

224
00:11:04.679 --> 00:11:05.159
<v Speaker 2>people have.

225
00:11:05.159 --> 00:11:09.879
<v Speaker 1>Created so it's like having access, yeah to this vast collection.

226
00:11:10.039 --> 00:11:11.559
<v Speaker 2>It's like a giant tool box.

227
00:11:11.679 --> 00:11:15.639
<v Speaker 1>Yeah, of pre built, pre built powershow tools, powersholl tool

228
00:11:15.759 --> 00:11:18.080
<v Speaker 1>This is getting better and better. It is now. I'm

229
00:11:18.120 --> 00:11:21.360
<v Speaker 1>really excited to see how all of this comes together

230
00:11:21.559 --> 00:11:24.600
<v Speaker 1>in a real world scenario. All right, where do we

231
00:11:24.639 --> 00:11:25.440
<v Speaker 1>go from here?

232
00:11:25.679 --> 00:11:28.840
<v Speaker 2>Since you're interested in managing computers remotely, okay, let's talk

233
00:11:28.879 --> 00:11:32.720
<v Speaker 2>about powershow remoting power Shell remoting. It's like having a

234
00:11:32.799 --> 00:11:36.720
<v Speaker 2>virtual control panel that lets you manage computers anywhere on

235
00:11:36.759 --> 00:11:37.360
<v Speaker 2>your network.

236
00:11:37.720 --> 00:11:41.360
<v Speaker 1>PowerShell remoting. Yeah, that sounds incredibly powerful.

237
00:11:41.519 --> 00:11:41.879
<v Speaker 2>It is.

238
00:11:42.360 --> 00:11:43.639
<v Speaker 1>Tell me more about how it works.

239
00:11:44.240 --> 00:11:48.519
<v Speaker 2>Imagine you need to install software, okay on one hundred computers.

240
00:11:49.159 --> 00:11:52.240
<v Speaker 2>Instead of manually logging into each one, Yeah, no, thanks,

241
00:11:52.440 --> 00:11:55.799
<v Speaker 2>you could use PowerShell remoting okay to send commands to

242
00:11:56.039 --> 00:11:57.360
<v Speaker 2>all of them simultaneously.

243
00:11:57.480 --> 00:11:59.559
<v Speaker 1>Oh wow, that would be a huge time saver.

244
00:12:00.080 --> 00:12:00.440
<v Speaker 2>It would be.

245
00:12:00.600 --> 00:12:02.600
<v Speaker 1>Ok what are some of the key things I need

246
00:12:02.639 --> 00:12:02.840
<v Speaker 1>to know?

247
00:12:04.039 --> 00:12:08.080
<v Speaker 2>So the book mentions this command, Yeah, called invoke command.

248
00:12:08.320 --> 00:12:11.840
<v Speaker 2>Invoke command, and that's your go to tool for running

249
00:12:11.840 --> 00:12:16.519
<v Speaker 2>commands on remote computers. It's great for quick tasks, but

250
00:12:16.559 --> 00:12:19.840
<v Speaker 2>for more complex scenarios, you might want to use something

251
00:12:19.879 --> 00:12:20.879
<v Speaker 2>called sessions.

252
00:12:21.200 --> 00:12:22.879
<v Speaker 1>Sessions, Yes, what are those?

253
00:12:23.000 --> 00:12:28.480
<v Speaker 2>So? A session is basically a persistent connection to a

254
00:12:28.559 --> 00:12:33.480
<v Speaker 2>remote computer. It lets you maintain that connection and execute

255
00:12:33.519 --> 00:12:37.799
<v Speaker 2>multiple commands without having to constantly re establish that communication.

256
00:12:38.159 --> 00:12:42.039
<v Speaker 1>Got it? Yeah, So invoke command for quick tasks, sessions

257
00:12:42.080 --> 00:12:46.360
<v Speaker 1>for more involved involve man management. Yeah, okay, Now I'm

258
00:12:46.480 --> 00:12:52.720
<v Speaker 1>really curious to see how this PowerShell remoting works in practice.

259
00:12:53.000 --> 00:12:56.240
<v Speaker 1>Do we have any real world examples to look at?

260
00:12:56.440 --> 00:13:01.519
<v Speaker 2>The book has this really cool example of creating a inventory.

261
00:13:00.960 --> 00:13:03.399
<v Speaker 1>Script server inventory script. What would that do?

262
00:13:03.559 --> 00:13:06.919
<v Speaker 2>So imagine you need to gather information about all the

263
00:13:06.960 --> 00:13:10.480
<v Speaker 2>servers on your network, things like their operating system versions,

264
00:13:10.559 --> 00:13:14.679
<v Speaker 2>their hardware specs, what software is installed on them. A

265
00:13:14.720 --> 00:13:18.240
<v Speaker 2>server inventory script can automate that whole process for you.

266
00:13:18.480 --> 00:13:22.159
<v Speaker 1>That sounds incredibly useful. It is, especially if you're managing

267
00:13:22.200 --> 00:13:23.639
<v Speaker 1>a large network.

268
00:13:23.279 --> 00:13:24.639
<v Speaker 2>If you have a lot of servers.

269
00:13:24.759 --> 00:13:27.840
<v Speaker 1>So how does PowerShell actually gather all that information?

270
00:13:28.399 --> 00:13:32.840
<v Speaker 2>The book focuses on using two main techniques okay, querying

271
00:13:33.039 --> 00:13:38.120
<v Speaker 2>active directory okay, and using these things called CIMWM I

272
00:13:38.440 --> 00:13:39.840
<v Speaker 2>cmdalitz Okay.

273
00:13:39.919 --> 00:13:41.559
<v Speaker 1>Active directory, I'm familiar with it.

274
00:13:41.639 --> 00:13:41.960
<v Speaker 2>Okay.

275
00:13:42.000 --> 00:13:45.000
<v Speaker 1>That's basically a directory of all the users.

276
00:13:45.240 --> 00:13:47.480
<v Speaker 2>It's like a phone book and computer, yeah, for your

277
00:13:47.519 --> 00:13:50.159
<v Speaker 2>network and the network right, Okay, it's a gold mine

278
00:13:50.200 --> 00:13:52.080
<v Speaker 2>of information okay for CIS edmins.

279
00:13:52.279 --> 00:13:56.279
<v Speaker 1>So we can query active directory to find out everything

280
00:13:56.360 --> 00:13:57.799
<v Speaker 1>we need to know about our server.

281
00:13:57.960 --> 00:14:02.720
<v Speaker 2>You can't their names, their I P addresses, they're operating systems,

282
00:14:03.120 --> 00:14:05.879
<v Speaker 2>domain memberships, and much more.

283
00:14:06.120 --> 00:14:11.480
<v Speaker 1>Active directory makes sense. But these cimw MI cmdalits.

284
00:14:10.960 --> 00:14:12.720
<v Speaker 2>Those sound a little bit more mysterious.

285
00:14:12.799 --> 00:14:17.080
<v Speaker 1>They're a little bit more low level, okay, but incredibly powerful.

286
00:14:17.600 --> 00:14:21.600
<v Speaker 1>Think of cimwm I as a way to talk directly

287
00:14:22.720 --> 00:14:27.000
<v Speaker 1>to the hardware and software components of your Windows systems.

288
00:14:27.679 --> 00:14:30.960
<v Speaker 1>They give you access to a ton of information that

289
00:14:31.039 --> 00:14:32.519
<v Speaker 1>you can't get through active directory.

290
00:14:32.600 --> 00:14:34.960
<v Speaker 2>The active directory is kind of like the high level

291
00:14:35.039 --> 00:14:36.919
<v Speaker 2>overview of the network.

292
00:14:36.639 --> 00:14:37.320
<v Speaker 1>The big picture.

293
00:14:37.519 --> 00:14:43.120
<v Speaker 2>And then CIWMI. Yeah, lets us drill down, drill down

294
00:14:43.320 --> 00:14:46.600
<v Speaker 2>into the nitty gritty detail exact of each server.

295
00:14:46.919 --> 00:14:50.519
<v Speaker 1>By combining those two techniques, you can gather a truly

296
00:14:50.679 --> 00:14:54.000
<v Speaker 1>comprehensive inventory of your server environment.

297
00:14:54.240 --> 00:14:58.600
<v Speaker 2>And the book even mentions, yes, generating reports from this data.

298
00:14:58.360 --> 00:14:59.279
<v Speaker 1>Reports are essential.

299
00:14:59.440 --> 00:15:02.120
<v Speaker 2>Okay, Yeah, I can see how that would be helpful

300
00:15:02.200 --> 00:15:04.519
<v Speaker 2>to visualize and analyze all that information.

301
00:15:04.639 --> 00:15:07.919
<v Speaker 1>It makes the data actionable, right Yeah, Okay, So this

302
00:15:08.039 --> 00:15:11.679
<v Speaker 1>server inventory script sounds like a great example. It is

303
00:15:11.960 --> 00:15:16.080
<v Speaker 1>how PowerShell can automate. It shows you this complex, real

304
00:15:16.159 --> 00:15:17.000
<v Speaker 1>world task.

305
00:15:17.120 --> 00:15:18.720
<v Speaker 2>It's a great practical example.

306
00:15:18.759 --> 00:15:22.519
<v Speaker 1>Cool, and there's even more real world projects. Oh, Yeah,

307
00:15:22.559 --> 00:15:23.399
<v Speaker 1>covered in this book.

308
00:15:23.440 --> 00:15:24.639
<v Speaker 2>The book is packed with them.

309
00:15:24.720 --> 00:15:29.320
<v Speaker 1>You also learn about automating user account creation, yes, deploying

310
00:15:29.360 --> 00:15:35.039
<v Speaker 1>web servers, working with cloud platforms like Azure and Aws.

311
00:15:34.440 --> 00:15:35.080
<v Speaker 2>All those things.

312
00:15:35.120 --> 00:15:37.120
<v Speaker 1>Wow, it sounds like we have a lot of exciting

313
00:15:37.120 --> 00:15:37.879
<v Speaker 1>material to make.

314
00:15:38.200 --> 00:15:39.320
<v Speaker 2>We have a lot to talk about.

315
00:15:39.480 --> 00:15:43.919
<v Speaker 1>This deep dive is really opening my eyes to the possibilities.

316
00:15:43.159 --> 00:15:43.960
<v Speaker 2>A powerful tool.

317
00:15:44.159 --> 00:15:47.919
<v Speaker 1>Yes, of PowerShell. What should we explore.

318
00:15:47.519 --> 00:15:50.440
<v Speaker 2>Next before we move on to more advanced projects?

319
00:15:50.519 --> 00:15:50.840
<v Speaker 1>Okay?

320
00:15:50.919 --> 00:15:53.559
<v Speaker 2>I think it would be helpful to get you comfortable

321
00:15:53.720 --> 00:15:57.080
<v Speaker 2>with the PowerShell console itself. Okay, so why don't we

322
00:15:57.120 --> 00:15:59.000
<v Speaker 2>try out a few basic commands?

323
00:15:59.240 --> 00:16:00.360
<v Speaker 1>All right, let's do it and.

324
00:16:00.320 --> 00:16:01.679
<v Speaker 2>See how it all works in practice.

325
00:16:01.720 --> 00:16:03.080
<v Speaker 1>I'm ready to get my hands dirty.

326
00:16:03.159 --> 00:16:05.799
<v Speaker 2>Okay, great, let's start with a cam dill it okay,

327
00:16:05.919 --> 00:16:06.919
<v Speaker 2>called get command.

328
00:16:07.039 --> 00:16:07.799
<v Speaker 1>Get command.

329
00:16:08.039 --> 00:16:10.120
<v Speaker 2>This is a great way to see all the available

330
00:16:10.120 --> 00:16:12.200
<v Speaker 2>commands and power show. So go ahead and type get

331
00:16:12.240 --> 00:16:15.240
<v Speaker 2>command in the console and press enter.

332
00:16:15.600 --> 00:16:18.080
<v Speaker 1>Okay, I see a long list of commands scrolling by.

333
00:16:18.399 --> 00:16:19.159
<v Speaker 2>There are a lot.

334
00:16:19.320 --> 00:16:22.799
<v Speaker 1>Wow, it looks like PowerShell has commands for just about everything.

335
00:16:22.919 --> 00:16:25.840
<v Speaker 2>It's a very versatile tool, it is. Yeah. Okay, now

336
00:16:25.919 --> 00:16:28.759
<v Speaker 2>let's try command. You might be familiar with from the

337
00:16:28.840 --> 00:16:32.360
<v Speaker 2>doss days. Type deer and press enter.

338
00:16:33.000 --> 00:16:35.360
<v Speaker 1>Okay, I see a listing of the files and folders

339
00:16:35.799 --> 00:16:38.759
<v Speaker 1>in my current directory. It looks just like the output

340
00:16:38.840 --> 00:16:41.679
<v Speaker 1>from the old deer command is Is that just a coincidence?

341
00:16:41.840 --> 00:16:42.320
<v Speaker 2>Not at all?

342
00:16:42.440 --> 00:16:42.840
<v Speaker 1>Okay?

343
00:16:42.960 --> 00:16:46.799
<v Speaker 2>So PowerShell has this feature called aliases okay, which are

344
00:16:46.840 --> 00:16:50.919
<v Speaker 2>basically nicknames for common commands. So deer is actually an

345
00:16:50.960 --> 00:16:55.600
<v Speaker 2>alias for the get child items CM dillit okay, which

346
00:16:55.639 --> 00:16:58.200
<v Speaker 2>is the PowerShell way to list files and folders.

347
00:16:58.399 --> 00:17:01.080
<v Speaker 1>So they kept some of the familiar man. Yeah, they

348
00:17:01.080 --> 00:17:03.399
<v Speaker 1>try to make it from other command line environments easy

349
00:17:03.440 --> 00:17:05.200
<v Speaker 1>to learn, to make it easier.

350
00:17:04.920 --> 00:17:08.440
<v Speaker 2>To people coming from different backgrounds, right, exactly. Now let's

351
00:17:08.480 --> 00:17:11.160
<v Speaker 2>try something a little more PowerShell specific.

352
00:17:11.200 --> 00:17:11.480
<v Speaker 1>Okay.

353
00:17:12.160 --> 00:17:15.279
<v Speaker 2>Remember the get member CM in tullet.

354
00:17:15.039 --> 00:17:18.000
<v Speaker 1>Get member we talked about earlier, the one that lets.

355
00:17:17.799 --> 00:17:19.799
<v Speaker 2>Us see the properties and.

356
00:17:19.839 --> 00:17:21.920
<v Speaker 1>Methods all the properties and methods of an object of

357
00:17:21.960 --> 00:17:22.839
<v Speaker 1>an object exactly?

358
00:17:22.960 --> 00:17:23.839
<v Speaker 2>Yes, I remember that one.

359
00:17:23.880 --> 00:17:27.720
<v Speaker 1>Okay. So let's create a simple string object like the

360
00:17:27.759 --> 00:17:31.519
<v Speaker 1>one we discussed before. Type this color equals blue color

361
00:17:31.519 --> 00:17:33.839
<v Speaker 1>equals blue, Press enter okay. Done.

362
00:17:33.960 --> 00:17:37.319
<v Speaker 2>Now let's use get member to see what's inside this

363
00:17:37.480 --> 00:17:41.839
<v Speaker 2>color object. Okay, type of color okay, pipe, okay, get member,

364
00:17:42.039 --> 00:17:46.640
<v Speaker 2>get member and press enter. Okay, now you should see.

365
00:17:46.400 --> 00:17:49.279
<v Speaker 1>Wow, this is amazing. Yeah, I see a whole list

366
00:17:49.319 --> 00:17:52.480
<v Speaker 1>of properties and methods. All those properties and methods, there's

367
00:17:52.480 --> 00:17:55.480
<v Speaker 1>the length property we talked aboutre it is and methods

368
00:17:55.599 --> 00:17:57.920
<v Speaker 1>like to upper and to a lower He got it.

369
00:17:58.119 --> 00:18:01.680
<v Speaker 1>So if I wanted to convert that string to all uppercase, yes,

370
00:18:01.839 --> 00:18:04.279
<v Speaker 1>I could just type your copyer two up exactly.

371
00:18:04.799 --> 00:18:07.839
<v Speaker 2>And if you want to converted to lowercase color to

372
00:18:07.920 --> 00:18:08.519
<v Speaker 2>lower Okay.

373
00:18:08.799 --> 00:18:13.400
<v Speaker 1>This object oriented approach is really starting to click for me.

374
00:18:13.599 --> 00:18:15.039
<v Speaker 2>It's a powerful concept.

375
00:18:15.200 --> 00:18:18.839
<v Speaker 1>It is. It's like each object has its own set

376
00:18:19.079 --> 00:18:21.440
<v Speaker 1>of tools and capability.

377
00:18:20.839 --> 00:18:24.359
<v Speaker 2>And that's one of the key things that makes PowerShell

378
00:18:24.559 --> 00:18:26.880
<v Speaker 2>so powerful, flexible.

379
00:18:27.200 --> 00:18:29.759
<v Speaker 1>This is really exciting, it is I'm starting to see

380
00:18:29.799 --> 00:18:30.920
<v Speaker 1>the potential of PowerShell.

381
00:18:31.079 --> 00:18:32.960
<v Speaker 2>Yeah, and we've only just scratched the surface.

382
00:18:33.119 --> 00:18:35.759
<v Speaker 1>I know, right, Yeah, and we've only just scratched the surface.

383
00:18:35.799 --> 00:18:37.920
<v Speaker 2>We have a lot more to explore. Okay, but for now,

384
00:18:38.200 --> 00:18:41.039
<v Speaker 2>let's take a short break and when we come back,

385
00:18:41.960 --> 00:18:47.519
<v Speaker 2>we'll dive into more advanced PowerShell techniques and real world examples.

386
00:18:48.640 --> 00:18:52.240
<v Speaker 2>Sounds good, Welcome back, You're ready to keep exploring the

387
00:18:52.279 --> 00:18:53.279
<v Speaker 2>world of PowerShell.

388
00:18:53.680 --> 00:18:55.960
<v Speaker 1>Absolutely, I'm excited to see what else we can do

389
00:18:56.000 --> 00:18:56.319
<v Speaker 1>with it.

390
00:18:56.400 --> 00:19:00.960
<v Speaker 2>All right, so you also send some info about security.

391
00:19:01.400 --> 00:19:04.279
<v Speaker 1>Yes, I was thinking, you know, if I'm going to

392
00:19:04.279 --> 00:19:07.599
<v Speaker 1>be using this in a work setting, I can't imagine

393
00:19:07.640 --> 00:19:11.400
<v Speaker 1>just embedding passwords in plain texts within a script.

394
00:19:11.599 --> 00:19:13.920
<v Speaker 2>No, No, never do that, but especially.

395
00:19:13.640 --> 00:19:15.480
<v Speaker 1>If they're going to be used on production systems.

396
00:19:15.680 --> 00:19:19.079
<v Speaker 2>Yeah, you got to keep security in mind, especially with PowerShell.

397
00:19:19.279 --> 00:19:22.839
<v Speaker 1>So how do we actually secure those sensitive bits of information?

398
00:19:23.559 --> 00:19:26.640
<v Speaker 2>Well, the book talks about using encryption to protect that

399
00:19:26.720 --> 00:19:27.319
<v Speaker 2>kind of data.

400
00:19:27.359 --> 00:19:29.720
<v Speaker 1>So are there built in tools for that? In PowerShell?

401
00:19:29.839 --> 00:19:34.119
<v Speaker 2>There are PowerShell has sem dalits specifically designed for encryption.

402
00:19:34.240 --> 00:19:35.200
<v Speaker 1>All right, what are they?

403
00:19:35.319 --> 00:19:38.599
<v Speaker 2>So there's the sem dealt called get Credential Credential, which

404
00:19:38.640 --> 00:19:42.799
<v Speaker 2>lets you store a username and password securely in something

405
00:19:42.839 --> 00:19:44.880
<v Speaker 2>called a PCEX credential object.

406
00:19:44.559 --> 00:19:46.279
<v Speaker 1>A piece credential object.

407
00:19:46.400 --> 00:19:48.880
<v Speaker 2>And then you can encrypt that and save it to

408
00:19:48.920 --> 00:19:49.319
<v Speaker 2>a file.

409
00:19:49.480 --> 00:19:51.079
<v Speaker 1>So it's like having a secure.

410
00:19:50.759 --> 00:19:53.400
<v Speaker 2>Vault exactly, much better than plain.

411
00:19:53.240 --> 00:19:56.680
<v Speaker 1>Text, right, way better? Okay, So encryption is important, always

412
00:19:56.680 --> 00:19:59.799
<v Speaker 1>a good idea, especially when we're dealing with these automated scripts.

413
00:19:59.519 --> 00:20:00.799
<v Speaker 2>Especially in work environment.

414
00:20:00.960 --> 00:20:03.559
<v Speaker 1>Right. Yeah, Now I'm curious to see how we can

415
00:20:03.599 --> 00:20:06.680
<v Speaker 1>apply all this knowledge to some real world tasks.

416
00:20:07.000 --> 00:20:07.119
<v Speaker 2>Right.

417
00:20:07.240 --> 00:20:09.759
<v Speaker 1>The book talks about a server inventory script.

418
00:20:09.880 --> 00:20:11.559
<v Speaker 2>Yeah, those are incredibly useful.

419
00:20:11.720 --> 00:20:12.880
<v Speaker 1>Okay, So what would that do.

420
00:20:13.160 --> 00:20:17.759
<v Speaker 2>Imagine you've got dozens or even hundreds of servers, okay,

421
00:20:17.880 --> 00:20:21.480
<v Speaker 2>and you need to know what operating systems they're running,

422
00:20:21.960 --> 00:20:26.039
<v Speaker 2>what hardware they have, what software is installed. A server

423
00:20:26.200 --> 00:20:28.799
<v Speaker 2>inventory script can automate all of that.

424
00:20:28.799 --> 00:20:32.279
<v Speaker 1>That sounds amazing, it really is. But how does PowerShell

425
00:20:32.359 --> 00:20:34.640
<v Speaker 1>actually gather all that information?

426
00:20:34.880 --> 00:20:38.960
<v Speaker 2>So the book uses two main techniques, okay, querying active

427
00:20:39.000 --> 00:20:43.319
<v Speaker 2>directory and using those cimwmcmdalits.

428
00:20:43.400 --> 00:20:45.160
<v Speaker 1>Yeah, IMWMRO we talked about earlier.

429
00:20:45.799 --> 00:20:48.680
<v Speaker 2>So active directory. Yeah, it's basically like a phone book

430
00:20:49.119 --> 00:20:50.079
<v Speaker 2>for the network.

431
00:20:50.480 --> 00:20:51.640
<v Speaker 1>That's a good way to think about it.

432
00:20:51.680 --> 00:20:51.920
<v Speaker 2>Okay.

433
00:20:52.079 --> 00:20:55.640
<v Speaker 1>It's a central directory of all the users and computers

434
00:20:55.640 --> 00:20:56.279
<v Speaker 1>on the network.

435
00:20:56.480 --> 00:20:59.599
<v Speaker 2>So active directory is like the high level view. It

436
00:20:59.640 --> 00:21:02.960
<v Speaker 2>gives you the big picture, okay, and then the CIMWM

437
00:21:03.000 --> 00:21:04.559
<v Speaker 2>I cmdal it's.

438
00:21:04.599 --> 00:21:07.680
<v Speaker 1>Those let you drill down, okay, into the specifics of

439
00:21:07.720 --> 00:21:08.559
<v Speaker 1>each machine.

440
00:21:08.839 --> 00:21:10.920
<v Speaker 2>So it's like active directory tells us you know the

441
00:21:10.960 --> 00:21:15.119
<v Speaker 2>server's name, it's IP address. Right, but then CIWM I

442
00:21:15.240 --> 00:21:17.359
<v Speaker 2>can tell us you know how much.

443
00:21:17.319 --> 00:21:20.319
<v Speaker 1>Ram it has, exactly what kind of hard drive, all

444
00:21:20.359 --> 00:21:21.400
<v Speaker 1>the details, got it.

445
00:21:21.480 --> 00:21:21.720
<v Speaker 3>Yeah.

446
00:21:22.160 --> 00:21:24.960
<v Speaker 1>So by combining these two techniques, yeah, you can get

447
00:21:24.960 --> 00:21:26.640
<v Speaker 1>a really comprehensive inventory.

448
00:21:27.839 --> 00:21:32.480
<v Speaker 2>And the book even mentions generating reports from this data.

449
00:21:32.839 --> 00:21:36.480
<v Speaker 1>Reports are essential for making that data useful. Yeah, because

450
00:21:36.519 --> 00:21:39.000
<v Speaker 1>otherwise it's just it's just a jumble of information. Right,

451
00:21:39.119 --> 00:21:42.759
<v Speaker 1>exact report can summarize it, present it in a way

452
00:21:42.839 --> 00:21:44.599
<v Speaker 1>that's easy to understand.

453
00:21:44.680 --> 00:21:48.480
<v Speaker 2>Okay, so you can spot trends, identify issues, so on.

454
00:21:49.279 --> 00:21:52.839
<v Speaker 1>So this server inventory script is a great example of

455
00:21:52.839 --> 00:21:54.480
<v Speaker 1>how PowerShell.

456
00:21:54.240 --> 00:21:56.960
<v Speaker 2>Can automate it is it's a really practical example.

457
00:21:57.160 --> 00:22:00.440
<v Speaker 1>Yeah, these complex real world tasks they had a lot

458
00:22:00.480 --> 00:22:03.440
<v Speaker 1>of sisiments have to do on a regular basis. So

459
00:22:03.480 --> 00:22:05.799
<v Speaker 1>what other real world projects?

460
00:22:05.839 --> 00:22:09.720
<v Speaker 2>Wowbow, does the book go into automating user account creation?

461
00:22:10.240 --> 00:22:13.039
<v Speaker 1>Oh, tell me about it. Yeah, creating user accounts one

462
00:22:13.119 --> 00:22:19.000
<v Speaker 1>by one. It's tedious, setting passwords, assigning group memberships.

463
00:22:19.200 --> 00:22:20.440
<v Speaker 2>Yeah, it's a real time sink.

464
00:22:21.079 --> 00:22:23.519
<v Speaker 1>I can see how automating that would be a huge win.

465
00:22:23.759 --> 00:22:26.000
<v Speaker 2>It would free up so much of your time. So

466
00:22:26.039 --> 00:22:28.519
<v Speaker 2>the book actually has a script that does just that.

467
00:22:28.880 --> 00:22:32.160
<v Speaker 2>It can generate user names based on first and last names,

468
00:22:32.559 --> 00:22:35.960
<v Speaker 2>set random passwords NIC and force password change so that

469
00:22:35.960 --> 00:22:37.640
<v Speaker 2>that's good at first, logan.

470
00:22:37.559 --> 00:22:40.359
<v Speaker 1>Right for security reasons exactly, okay.

471
00:22:40.440 --> 00:22:43.880
<v Speaker 2>And even assign those departmental attributes and employee numbers.

472
00:22:44.319 --> 00:22:46.039
<v Speaker 1>So it's like having a personal assistant.

473
00:22:46.119 --> 00:22:48.680
<v Speaker 2>It's like having a little helper that takes care of

474
00:22:48.720 --> 00:22:49.799
<v Speaker 2>all that tedious work.

475
00:22:49.880 --> 00:22:52.599
<v Speaker 1>And the best part is what's that we can customize it.

476
00:22:52.799 --> 00:22:57.000
<v Speaker 1>You can absolutely customize it to fit our organization's specific.

477
00:22:56.519 --> 00:22:58.559
<v Speaker 2>Requirements and fit your exact needs.

478
00:22:58.680 --> 00:23:03.039
<v Speaker 1>Okay, So user account creation another task automated, another one.

479
00:23:02.880 --> 00:23:05.759
<v Speaker 2>Off the list. What else, have a deploying web servers

480
00:23:05.759 --> 00:23:06.240
<v Speaker 2>with ice?

481
00:23:06.920 --> 00:23:09.279
<v Speaker 1>Deploying web servers with ICE?

482
00:23:09.640 --> 00:23:11.720
<v Speaker 2>PowerShell can automate that whole process too.

483
00:23:11.960 --> 00:23:14.839
<v Speaker 1>Wow, So it's not just for managing Windows systems.

484
00:23:14.920 --> 00:23:16.759
<v Speaker 2>No, PowerShell can do a lot more than that. It

485
00:23:16.799 --> 00:23:18.480
<v Speaker 2>can even handle web server stuff.

486
00:23:18.519 --> 00:23:21.559
<v Speaker 1>So what kind of tasks can we automate with PowerShell?

487
00:23:21.720 --> 00:23:22.680
<v Speaker 1>In that context?

488
00:23:22.839 --> 00:23:27.880
<v Speaker 2>You can create websites, configure bindings bindings, set up app

489
00:23:27.920 --> 00:23:33.160
<v Speaker 2>pools at pools, and even configure SSL certificates.

490
00:23:32.559 --> 00:23:35.200
<v Speaker 1>Hold on bindings at pools, SSL certificates.

491
00:23:35.279 --> 00:23:37.319
<v Speaker 2>Yeah, it's a whole new world can.

492
00:23:37.160 --> 00:23:39.640
<v Speaker 1>You break those down for me. I'm not super familiar

493
00:23:39.680 --> 00:23:41.559
<v Speaker 1>with all the web server jargon.

494
00:23:41.759 --> 00:23:46.720
<v Speaker 2>So bindings basically determine how clients connect to your website.

495
00:23:47.119 --> 00:23:50.359
<v Speaker 2>They specify the IP address right, the port, and the

496
00:23:50.359 --> 00:23:54.480
<v Speaker 2>host name at Pools are like containers that isolate different

497
00:23:54.519 --> 00:23:57.400
<v Speaker 2>websites and applications running on your server.

498
00:23:57.839 --> 00:23:58.119
<v Speaker 1>Okay.

499
00:23:58.240 --> 00:24:03.839
<v Speaker 2>And SSL certificates, yeah, provide encryption and security for your

500
00:24:03.880 --> 00:24:04.839
<v Speaker 2>website's traffic.

501
00:24:05.119 --> 00:24:08.559
<v Speaker 1>Okay. So basically PowerShell gives us granular control.

502
00:24:08.680 --> 00:24:10.759
<v Speaker 2>It gives you complete control over all.

503
00:24:10.640 --> 00:24:13.319
<v Speaker 1>Those aspects of a web server. That's just starting to

504
00:24:13.359 --> 00:24:16.720
<v Speaker 1>feel like we're building a whole it infrastructure with code.

505
00:24:17.240 --> 00:24:19.920
<v Speaker 2>It's like you're an architect, but instead of bricks and mortar,

506
00:24:20.440 --> 00:24:22.160
<v Speaker 2>you're using PowerShell commands.

507
00:24:22.279 --> 00:24:26.559
<v Speaker 1>What else can PowerShell do in terms of managing servers

508
00:24:26.559 --> 00:24:28.119
<v Speaker 1>and applications.

509
00:24:27.400 --> 00:24:28.839
<v Speaker 2>Well, we can't forget about the cloud.

510
00:24:29.279 --> 00:24:30.759
<v Speaker 1>The cloud, oh right, Yeah.

511
00:24:30.640 --> 00:24:33.200
<v Speaker 2>The book actually dedicates a whole section to working with

512
00:24:33.359 --> 00:24:35.759
<v Speaker 2>cloud platforms like Azure and AWS.

513
00:24:36.039 --> 00:24:40.079
<v Speaker 1>So PowerShell is not just limited to on premises stuff.

514
00:24:40.480 --> 00:24:42.079
<v Speaker 2>It can reach out to the cloud as well.

515
00:24:42.240 --> 00:24:44.400
<v Speaker 1>Okay, what are some of the things we can do?

516
00:24:44.759 --> 00:24:47.839
<v Speaker 3>You can create virtual machines with PowerShell in the cloud

517
00:24:48.119 --> 00:24:54.759
<v Speaker 3>in Azure or AWS, manage storage accounts, deploy applications, okay,

518
00:24:55.359 --> 00:24:58.759
<v Speaker 3>even orchestrate complex cloud workflows.

519
00:24:59.319 --> 00:25:00.640
<v Speaker 2>Wow, power show.

520
00:25:00.720 --> 00:25:03.680
<v Speaker 1>It sounds like PowerShell's becoming like the universal language. It's

521
00:25:03.720 --> 00:25:06.839
<v Speaker 1>becoming very popular of it automation, especially as more and

522
00:25:06.839 --> 00:25:10.000
<v Speaker 1>more organizations move to the cloud. Right, yeah, okay, cloud

523
00:25:10.039 --> 00:25:13.440
<v Speaker 1>automation check. Check what other superpowers?

524
00:25:13.640 --> 00:25:16.440
<v Speaker 2>How about building your own PowerShell modules?

525
00:25:16.480 --> 00:25:19.160
<v Speaker 1>Does PowerShell have in store for us? That's right, building

526
00:25:19.160 --> 00:25:19.920
<v Speaker 1>our own modules.

527
00:25:19.960 --> 00:25:23.839
<v Speaker 2>So once you're comfortable with PowerShell, you can start packaging

528
00:25:23.880 --> 00:25:28.240
<v Speaker 2>your own scripts okay and functions into reusable modules.

529
00:25:28.240 --> 00:25:30.160
<v Speaker 1>So we could create our own custom.

530
00:25:29.839 --> 00:25:32.559
<v Speaker 2>Yeah, your own custom tools, PowerShell tools tailored to your

531
00:25:32.559 --> 00:25:33.519
<v Speaker 2>specific needs.

532
00:25:33.720 --> 00:25:34.720
<v Speaker 1>That's really cool.

533
00:25:35.000 --> 00:25:38.039
<v Speaker 2>It's a great way to level up your PowerShell skills

534
00:25:38.400 --> 00:25:39.160
<v Speaker 2>right right.

535
00:25:39.319 --> 00:25:41.880
<v Speaker 1>This deep dive is taking us on quite a.

536
00:25:41.880 --> 00:25:42.559
<v Speaker 3>Journey, it is.

537
00:25:42.599 --> 00:25:43.720
<v Speaker 2>We've covered a lot of ground.

538
00:25:43.839 --> 00:25:48.480
<v Speaker 1>We've gone from basic commands to cloud automation.

539
00:25:48.319 --> 00:25:50.880
<v Speaker 2>And now module development and module development.

540
00:25:50.960 --> 00:25:52.279
<v Speaker 1>Yeah, what's next?

541
00:25:52.559 --> 00:25:55.359
<v Speaker 2>Last time we talked about this project called power lab.

542
00:25:55.640 --> 00:25:58.359
<v Speaker 1>Power Lab remember that, Yes.

543
00:25:58.079 --> 00:26:01.799
<v Speaker 2>For building a whole lab environment from scratch, from scratch

544
00:26:02.200 --> 00:26:03.119
<v Speaker 2>using PowerShell.

545
00:26:03.319 --> 00:26:04.920
<v Speaker 1>I'm dying to know more about that.

546
00:26:04.920 --> 00:26:06.079
<v Speaker 2>That's a really fun project.

547
00:26:06.359 --> 00:26:09.400
<v Speaker 1>Welcome back to our deep dive into PowerShell. Last time

548
00:26:09.440 --> 00:26:11.400
<v Speaker 1>we were talking about this power lab project.

549
00:26:11.559 --> 00:26:13.279
<v Speaker 2>Yeah, power lab that lets us.

550
00:26:13.200 --> 00:26:18.519
<v Speaker 1>Build a whole lab environment from scratch using code. It's

551
00:26:18.559 --> 00:26:21.160
<v Speaker 1>a pretty amazing project, it is, and I'm really curious

552
00:26:21.200 --> 00:26:22.000
<v Speaker 1>to hear more about it.

553
00:26:22.079 --> 00:26:25.240
<v Speaker 2>Okay, Well, power Lab is a great example of how

554
00:26:25.319 --> 00:26:26.599
<v Speaker 2>powerful PowerShell can be.

555
00:26:26.960 --> 00:26:27.440
<v Speaker 1>Okay.

556
00:26:27.880 --> 00:26:31.200
<v Speaker 2>Imagine you can set up an entire virtual network, okay,

557
00:26:31.240 --> 00:26:35.559
<v Speaker 2>with servers, active directory and everything you need for testing

558
00:26:35.599 --> 00:26:36.160
<v Speaker 2>and development.

559
00:26:36.279 --> 00:26:39.920
<v Speaker 1>So it's like, all with code, our own little IT playground.

560
00:26:39.640 --> 00:26:42.440
<v Speaker 2>Exactly, your own personal IT playground. I like that.

561
00:26:42.680 --> 00:26:45.880
<v Speaker 1>Yeah, okay, but where would you even begin with something

562
00:26:45.920 --> 00:26:46.279
<v Speaker 1>like that?

563
00:26:46.839 --> 00:26:50.319
<v Speaker 2>It can seem daunting. Yeah, but that's the beauty of

564
00:26:50.359 --> 00:26:53.480
<v Speaker 2>power Lab Okay. It's designed to be approachable okay and

565
00:26:53.599 --> 00:26:54.880
<v Speaker 2>modular Okay.

566
00:26:54.920 --> 00:26:58.640
<v Speaker 1>So it breaks down this complex task exactly into smaller,

567
00:26:58.799 --> 00:27:00.000
<v Speaker 1>more manageable steps.

568
00:27:00.359 --> 00:27:02.720
<v Speaker 2>Right. The book starts by mentioning something called the power

569
00:27:02.799 --> 00:27:04.200
<v Speaker 2>Lab installer.

570
00:27:03.920 --> 00:27:05.359
<v Speaker 1>The power Lab installer.

571
00:27:05.400 --> 00:27:06.079
<v Speaker 2>What do you think that this?

572
00:27:06.480 --> 00:27:09.200
<v Speaker 1>Well, if power Lab is like building a house, okay,

573
00:27:09.279 --> 00:27:12.440
<v Speaker 1>I'm guessing the installer is kind of like laying the foundation.

574
00:27:12.759 --> 00:27:15.279
<v Speaker 2>You got it? Okay, It preps your system.

575
00:27:15.000 --> 00:27:16.160
<v Speaker 1>So it gets everything ready.

576
00:27:16.559 --> 00:27:20.440
<v Speaker 2>It takes care of all the prerequisites okay, like enabling PowerShell,

577
00:27:20.480 --> 00:27:25.920
<v Speaker 2>remoting ok configuring firewall rules, setting up user accounts, even

578
00:27:25.920 --> 00:27:28.480
<v Speaker 2>installing any necessary Windows features.

579
00:27:28.240 --> 00:27:30.440
<v Speaker 1>So it handles all that tedious setup stuff.

580
00:27:30.519 --> 00:27:32.599
<v Speaker 2>It automates all of that for you. I like it,

581
00:27:32.680 --> 00:27:34.039
<v Speaker 2>so you can just dive right.

582
00:27:33.880 --> 00:27:35.880
<v Speaker 1>In, right into the fun part to.

583
00:27:35.880 --> 00:27:39.960
<v Speaker 2>Building your lab environment. Now, once the power lab installer

584
00:27:40.039 --> 00:27:44.000
<v Speaker 2>has done its thing, Yeah, what do you think happens next?

585
00:27:44.160 --> 00:27:46.720
<v Speaker 1>Well, now we've got to actually build the lab environment

586
00:27:46.799 --> 00:27:49.119
<v Speaker 1>right right, So that's where we start defining all the

587
00:27:49.119 --> 00:27:51.200
<v Speaker 1>functions exactly do all the work.

588
00:27:51.240 --> 00:27:54.079
<v Speaker 2>So, for example, you might have a function called new

589
00:27:54.079 --> 00:27:55.960
<v Speaker 2>power lab vm okay.

590
00:27:55.680 --> 00:27:58.119
<v Speaker 1>For creating a virtual machine.

591
00:27:57.880 --> 00:28:00.559
<v Speaker 2>Right, or a new power Lab VHD okay.

592
00:28:00.319 --> 00:28:02.160
<v Speaker 1>For creating a virtual hard disk.

593
00:28:02.079 --> 00:28:04.920
<v Speaker 2>Exactly, or install powerly operating.

594
00:28:04.519 --> 00:28:06.119
<v Speaker 1>Systems, install the operating steam.

595
00:28:06.160 --> 00:28:07.000
<v Speaker 2>Yeah you're getting it.

596
00:28:07.039 --> 00:28:10.440
<v Speaker 1>So we're basically creating this toolbox. It's like a toolbox

597
00:28:10.519 --> 00:28:11.960
<v Speaker 1>of a reusable component, so.

598
00:28:11.920 --> 00:28:14.559
<v Speaker 2>Of specialized tools, right that we can then use to

599
00:28:14.640 --> 00:28:16.359
<v Speaker 2>build whatever lab environment, to.

600
00:28:16.319 --> 00:28:19.000
<v Speaker 1>Build whatever we need you need. And this is where

601
00:28:19.039 --> 00:28:22.640
<v Speaker 1>that verb noun naming convention comes in handy right, absolutely,

602
00:28:22.680 --> 00:28:24.279
<v Speaker 1>to keep everything organized.

603
00:28:23.920 --> 00:28:25.519
<v Speaker 2>Especially in a big project like.

604
00:28:25.480 --> 00:28:27.640
<v Speaker 1>This, right with so many different functions.

605
00:28:27.720 --> 00:28:30.799
<v Speaker 2>Yeah, you want your code to be readable and easy

606
00:28:30.799 --> 00:28:31.480
<v Speaker 2>to understand.

607
00:28:31.640 --> 00:28:34.119
<v Speaker 1>Okay, So we've got the foundation laid, We've got our

608
00:28:34.119 --> 00:28:34.920
<v Speaker 1>toolbox ready.

609
00:28:35.039 --> 00:28:35.359
<v Speaker 2>Okay.

610
00:28:35.799 --> 00:28:37.240
<v Speaker 1>What are some of the key steps.

611
00:28:37.480 --> 00:28:39.319
<v Speaker 2>So one of the first things you'll want to do.

612
00:28:39.799 --> 00:28:43.599
<v Speaker 1>In actually building the lab environment is set up active

613
00:28:43.599 --> 00:28:44.599
<v Speaker 1>directory directory.

614
00:28:44.720 --> 00:28:47.119
<v Speaker 2>Right, that's the heart of any Windows network, right.

615
00:28:46.960 --> 00:28:49.839
<v Speaker 1>For managing users and permissions and all that exactly. So

616
00:28:49.880 --> 00:28:51.519
<v Speaker 1>do we have to manually set that up?

617
00:28:51.720 --> 00:28:55.039
<v Speaker 2>No? No, No, PowerShell can automate that too, okay. Yeah. Power

618
00:28:55.079 --> 00:28:58.920
<v Speaker 2>lab has functions all right, for creating a new forest okay,

619
00:28:59.000 --> 00:29:04.079
<v Speaker 2>defining organizational units, creating user accounts, even assigning group memberships,

620
00:29:04.440 --> 00:29:06.519
<v Speaker 2>all through code, all through PowerShell scripts.

621
00:29:06.519 --> 00:29:08.920
<v Speaker 1>It's like we're building an IT empire with code.

622
00:29:09.200 --> 00:29:10.880
<v Speaker 2>I like that an IT empire.

623
00:29:11.319 --> 00:29:13.599
<v Speaker 1>What about the other parts of the lab, like what

624
00:29:14.000 --> 00:29:16.680
<v Speaker 1>like the SQL server and the web server. Do those

625
00:29:16.720 --> 00:29:18.559
<v Speaker 1>get the same automated treatment?

626
00:29:18.640 --> 00:29:22.000
<v Speaker 2>Of course they do. Okay. Remember all those cmd lets,

627
00:29:22.240 --> 00:29:26.480
<v Speaker 2>Yeah we talked about for configuring websites and bindings and

628
00:29:26.720 --> 00:29:27.680
<v Speaker 2>SSL certificates.

629
00:29:27.720 --> 00:29:29.200
<v Speaker 1>It's all coming back to me now.

630
00:29:29.480 --> 00:29:32.799
<v Speaker 2>Our lab uses all of that deploying configure.

631
00:29:32.920 --> 00:29:36.119
<v Speaker 1>So we're taking all these individual building blocks and assembling

632
00:29:36.119 --> 00:29:36.799
<v Speaker 1>them into.

633
00:29:36.599 --> 00:29:37.720
<v Speaker 2>A complete system, into a.

634
00:29:37.720 --> 00:29:41.000
<v Speaker 1>Functional lab environment exactly. So by the end of this project,

635
00:29:41.359 --> 00:29:43.359
<v Speaker 1>we essentially have a fully functional lab.

636
00:29:43.480 --> 00:29:46.400
<v Speaker 2>You'll have a fully automated lab environment that we can

637
00:29:46.559 --> 00:29:50.359
<v Speaker 2>use for whatever we want, that you can use for testing, development,

638
00:29:50.440 --> 00:29:51.720
<v Speaker 2>whatever you can dream up.

639
00:29:51.920 --> 00:29:53.839
<v Speaker 1>That's incredible.

640
00:29:53.920 --> 00:29:54.640
<v Speaker 2>It is pretty cool.

641
00:29:54.680 --> 00:29:56.400
<v Speaker 1>And the book doesn't stop there, right.

642
00:29:56.480 --> 00:29:58.000
<v Speaker 2>Nope, it goes even further.

643
00:29:58.119 --> 00:30:00.319
<v Speaker 1>It talks about refactoring the code.

644
00:30:00.440 --> 00:30:03.680
<v Speaker 2>Yes, refactory, can you explain what that is? Sure? Think

645
00:30:03.720 --> 00:30:07.440
<v Speaker 2>of refactoring, okay, as kind of tidying up your code,

646
00:30:07.880 --> 00:30:11.440
<v Speaker 2>making it more efficient, more readable, easier to.

647
00:30:11.400 --> 00:30:13.599
<v Speaker 1>Maintain, without actually changing what it does.

648
00:30:13.480 --> 00:30:14.880
<v Speaker 2>Without changing its functionality.

649
00:30:14.920 --> 00:30:16.319
<v Speaker 1>So it's like cleaning up your workshop.

650
00:30:16.440 --> 00:30:18.160
<v Speaker 2>It's like organizing your tools.

651
00:30:17.880 --> 00:30:19.599
<v Speaker 1>After a big project exactly.

652
00:30:19.720 --> 00:30:23.680
<v Speaker 2>Okay. Yeah, So the book shows you how to identify

653
00:30:24.319 --> 00:30:27.359
<v Speaker 2>common patterns in the code and extract them into more

654
00:30:27.400 --> 00:30:28.319
<v Speaker 2>generic functions.

655
00:30:28.440 --> 00:30:31.839
<v Speaker 1>So we're creating even more reusable building blocks.

656
00:30:31.880 --> 00:30:34.480
<v Speaker 2>You got it. We can save you even more time

657
00:30:34.680 --> 00:30:35.319
<v Speaker 2>in the future.

658
00:30:35.480 --> 00:30:38.880
<v Speaker 1>This whole deep dive, it's it's been an incredible journey

659
00:30:38.920 --> 00:30:41.799
<v Speaker 1>we've covered with that We've gone from basic commands basic

660
00:30:41.839 --> 00:30:49.960
<v Speaker 1>commands to cloud automation, coltivation, to module developed, module development, refactory, factory,

661
00:30:50.000 --> 00:30:51.440
<v Speaker 1>the whole nine yards.

662
00:30:51.559 --> 00:30:54.039
<v Speaker 2>It's amazing what you can do, it is with just

663
00:30:54.079 --> 00:30:55.160
<v Speaker 2>a few lines of code.

664
00:30:55.359 --> 00:30:57.240
<v Speaker 1>PowerShell is a powerful tool.

665
00:30:57.160 --> 00:30:58.559
<v Speaker 2>It is, and this is just the beginning.

666
00:30:58.759 --> 00:31:01.319
<v Speaker 1>This is just the beginning of your PowerShell adventure.

667
00:31:01.559 --> 00:31:03.240
<v Speaker 2>There's always more to learn.

668
00:31:03.039 --> 00:31:06.759
<v Speaker 1>There's always something new to explore, exactly, so keep learning,

669
00:31:07.160 --> 00:31:09.960
<v Speaker 1>keep experimenting, and never stop automating.

670
00:31:10.160 --> 00:31:13.519
<v Speaker 2>Well said, this has been a truly inspiring deep dive.

671
00:31:13.640 --> 00:31:14.799
<v Speaker 1>I'm glad you enjoyed.

672
00:31:14.559 --> 00:31:16.200
<v Speaker 2>It into the world of PowerShell.

673
00:31:16.319 --> 00:31:18.319
<v Speaker 1>It's a fascinating world it is.

674
00:31:18.440 --> 00:31:20.519
<v Speaker 2>Thank you so much for joining me on this journey.

675
00:31:20.559 --> 00:31:23.920
<v Speaker 1>It was my pleasure. And to you listening, Keep exploring,

676
00:31:24.039 --> 00:31:27.000
<v Speaker 1>keep scripting, and who knows what amazing things you'll create

677
00:31:27.039 --> 00:31:27.839
<v Speaker 1>with PowerShell.
