WEBVTT

00:03.050 --> 00:07.370
Lab moving from script to function to module scenario.

00:08.210 --> 00:12.140
You have written a script that performs an administrative task in your environment.

00:13.040 --> 00:18.230
You have to package that script as a Windows PowerShell script module so that it can be more easily

00:18.230 --> 00:20.690
used by other administrators in your environment.

00:21.590 --> 00:22.670
Exercise one.

00:22.790 --> 00:24.560
Convert the script to a function.

00:25.340 --> 00:26.140
Task one.

00:26.150 --> 00:27.740
Add the function declaration.

00:28.580 --> 00:33.770
Note These instructions provide a starting point that does not require you to have completed any prior

00:33.770 --> 00:34.550
lab tasks.

00:35.450 --> 00:38.300
The starting point includes all tasks up to this one.

00:39.140 --> 00:43.670
If you are working on your own script, you can compare it to the starting point before you attempt

00:43.670 --> 00:44.330
this task.

00:45.200 --> 00:45.620
One.

00:45.890 --> 00:46.280
Close.

00:46.280 --> 00:48.050
All open files in the ISC.

00:48.890 --> 00:50.360
Two on the file menu.

00:50.360 --> 00:51.110
Click open.

00:52.030 --> 00:52.520
Three.

00:52.630 --> 00:55.750
Navigate to the scripts, location and open exercise one.

00:55.750 --> 00:57.430
Task 1.1.

00:58.270 --> 00:58.630
Four.

00:58.630 --> 00:59.920
Press Control Plus eight.

00:59.920 --> 01:01.390
To Select all the content.

01:02.320 --> 01:02.820
Five.

01:02.860 --> 01:04.750
Press tab to indent the content.

01:05.680 --> 01:06.170
Six.

01:06.340 --> 01:07.230
Online one.

01:07.240 --> 01:09.490
Add the following function.

01:09.490 --> 01:10.450
Get this info.

01:29.320 --> 01:34.330
Seven online 28 Add the following eight on the file menu.

01:34.330 --> 01:43.270
Click Save as nine in the file name box type C colon backslash tools dot PS1 and then press enter if

01:43.270 --> 01:46.780
you are prompted in the confirmed save as dialog box click yes.

01:47.680 --> 01:51.100
Task to execute the function note.

01:51.160 --> 01:56.110
These instructions provide a starting point that does not require you to have completed any prior lab

01:56.110 --> 01:56.650
tasks.

01:57.550 --> 02:00.400
The starting point includes all tasks up to this one.

02:01.240 --> 02:05.770
If you are working on your own script, you can compare it to the starting point before you attempt

02:05.770 --> 02:06.430
this task.

02:07.310 --> 02:12.080
One close all open files in the IAC on the file menu.

02:12.090 --> 02:18.980
Click open to navigate to the scripts location and open exercise one Task 2.1.

02:19.850 --> 02:29.960
Three Online 30 Add the following get disk info comp local host for on the file menu click save as five

02:29.960 --> 02:37.940
in the file name box type C colon backslash tools dot PS1 and then press enter six in the confirm save

02:37.940 --> 02:39.860
as dialog box click yes.

02:40.760 --> 02:42.590
Task three test the script.

02:43.490 --> 02:48.680
Note These instructions provide a starting point that does not require you to have completed any prior

02:48.680 --> 02:49.460
lab tasks.

02:50.360 --> 02:53.210
The starting point includes all tasks up to this one.

02:54.050 --> 02:58.610
If you are working on your own script, you can compare it to the starting point before you attempt

02:58.610 --> 02:59.270
this task.

03:00.130 --> 03:09.010
One close all open files in the ISC on the file menu select open to navigate to your scripts, location

03:09.010 --> 03:19.210
and open exercise one Task 3.13 on the file menu Select Save as four in the file name box type C colon

03:19.210 --> 03:22.360
backslash tools dot PS1 and then press enter.

03:23.230 --> 03:26.410
Five in the confirm save as dialog box click.

03:26.410 --> 03:26.830
Yes.

03:27.760 --> 03:28.270
Six.

03:28.510 --> 03:29.500
Press f five.

03:30.390 --> 03:33.540
Exercise to save the script as a script module.

03:34.410 --> 03:36.720
Task one Remove the function call.

03:37.620 --> 03:42.780
Note These instructions provide a starting point that does not require you to have completed any prior

03:42.780 --> 03:43.560
lab tasks.

03:44.490 --> 03:47.340
The starting point includes all tasks up to this one.

03:48.180 --> 03:52.710
If you are working on your own script, you can compare it to the starting point before you attempt

03:52.710 --> 03:53.370
this task.

03:54.240 --> 03:59.040
One close all open files in the ISC on the file menu.

03:59.040 --> 04:08.970
Click open to navigate to our scripts, location and open exercise two Task 1.13 on the file menu Click

04:08.970 --> 04:16.200
Save as four in the file name box type C colon backslash tools dot one and then press enter.

04:17.100 --> 04:20.280
Five in the confirmed save as dialog box click.

04:20.280 --> 04:20.700
Yes.

04:21.630 --> 04:22.110
Six.

04:22.260 --> 04:24.930
Delete line 37.

04:25.080 --> 04:30.390
Press Control Plus s task to save the script as a script module.

04:31.290 --> 04:36.450
Note These instructions provide a starting point that does not require you to have completed any prior

04:36.450 --> 04:37.230
lab tasks.

04:38.160 --> 04:41.010
The starting point includes all tasks up to this one.

04:41.820 --> 04:46.380
If you are working on your own script, you can compare it to the starting point before you attempt

04:46.380 --> 04:47.040
this task.

04:47.910 --> 04:49.350
One on the taskbar.

04:49.380 --> 04:55.560
Click the file Explorer icon to open a new file Explorer Window two in the Left Tree View.

04:55.590 --> 04:57.240
Click the documents library.

04:58.140 --> 04:58.650
Three.

04:58.800 --> 05:04.860
Expand the documents library and click documents four on the ribbon click new folder.

05:05.780 --> 05:06.260
Five.

05:06.530 --> 05:10.070
Type Windows PowerShell and Press Enter six.

05:10.370 --> 05:14.830
Double click the Windows PowerShell folder seven on the ribbon.

05:14.840 --> 05:16.340
Click the new folder button.

05:17.180 --> 05:19.490
Eight type modules and press enter.

05:20.360 --> 05:22.880
Nine Double click the modules folder.

05:23.750 --> 05:26.000
Ten on the ribbon click new folder.

05:26.900 --> 05:29.480
11 Type my tools and press enter.

05:30.360 --> 05:32.990
12 Closed the file Explorer Window.

05:33.890 --> 05:37.280
13 Click the Windows PowerShell IAC Window.

05:38.150 --> 05:40.040
14 On the file menu.

05:40.040 --> 05:40.820
Click Open.

05:41.720 --> 05:45.500
15 Navigate to your scripts, location and open exercise.

05:45.500 --> 05:47.360
Two Task 2.1.

05:48.200 --> 05:50.120
16 On the file menu.

05:50.120 --> 05:51.150
Click Save Errors.

05:52.100 --> 05:54.680
17 In the file name box type.

05:54.680 --> 05:57.920
C Colon Backslash Users Backslash User Single Quote.

05:57.920 --> 06:03.830
S Home Directory Backslash Documents Backslash Windows PowerShell backslash modules backslash my tools

06:03.830 --> 06:07.460
backslash my tools dot PSM one and then press enter.

06:08.330 --> 06:10.640
Task three Test the script module.

06:11.510 --> 06:15.530
Note Ensure that you complete the prior task before you attempt this task.

06:16.400 --> 06:24.860
One in the Windows PowerShell ISC Press Control plus d to type the following and press enter get disk

06:24.860 --> 06:31.340
info comp local host three Type the following and press enter because the module may not be loaded.

06:31.610 --> 06:34.190
This command may produce an error that you may ignore.

06:35.060 --> 06:36.560
Remove module my tools.

06:50.530 --> 06:53.440
Exercise three and debugging breakpoints.

06:54.310 --> 06:56.050
Task one at a break point.

06:56.950 --> 07:02.140
Note These instructions provide a starting point that does not require you to have completed any prior

07:02.140 --> 07:02.920
lab tasks.

07:03.850 --> 07:06.700
The starting point includes all tasks up to this one.

07:07.510 --> 07:12.070
If you are working on your own script, you can compare it to the starting point before you attempt

07:12.070 --> 07:12.730
this task.

07:13.600 --> 07:18.370
One close all open files in the IAC on the file menu.

07:18.370 --> 07:28.150
Click open to navigate to to your scripts location and open exercise 3.13 on the file menu click save

07:28.150 --> 07:28.510
as.

07:29.420 --> 07:35.480
Forward in the file name box type C colon backslash users backslash your user's home directory backslash

07:35.480 --> 07:41.210
documents backslash windows PowerShell backslash module's backslash my tool's backslash my tools dot

07:41.210 --> 07:43.400
psm one and then press enter.

07:44.290 --> 07:47.470
Five in the confirmed save as dialog box click.

07:47.470 --> 07:47.890
Yes.

07:48.820 --> 07:50.840
Six online 23.

07:50.860 --> 07:56.650
Add the following write debug about to query dollar computer name seven.

07:56.650 --> 07:59.020
Press Control plus s to save the file.

07:59.860 --> 08:04.240
Eight Close the file task to test the script module.

08:05.140 --> 08:10.330
Note These instructions provide a starting point that does not require you to have completed any prior

08:10.330 --> 08:11.110
lab tasks.

08:12.010 --> 08:14.860
The starting point includes all tasks up to this one.

08:15.700 --> 08:20.230
If you are working on your own script, you can compare it to the starting point before you attempt

08:20.230 --> 08:20.890
this task.

08:21.760 --> 08:23.380
One on the file menu.

08:23.380 --> 08:28.510
Click open to navigate to your scripts, location and open exercise.

08:28.510 --> 08:32.910
Three Task 2.13 on the file menu.

08:32.920 --> 08:33.940
Click Save As.

08:34.870 --> 08:40.930
Forward in the file name box type C colon backslash users backslash your user's home directory backslash

08:40.930 --> 08:46.660
documents backslash windows PowerShell backslash module's backslash my tool's backslash my tool's dot

08:46.660 --> 08:48.820
PSM one and then press enter.

08:49.740 --> 08:52.920
Five in the confirms save as dialog box click.

08:52.920 --> 08:53.340
Yes.

08:54.270 --> 08:54.750
Six.

08:55.080 --> 08:57.960
Press control plus D seven.

08:58.050 --> 08:59.760
Type the following and press enter.

09:00.600 --> 09:03.930
Get Disc Info comp local host eight.

09:04.170 --> 09:05.880
Type the following and press enter.

09:06.720 --> 09:07.740
Get disk info.

09:07.740 --> 09:08.490
Comp local.

09:08.490 --> 09:10.710
Host debug nine.

09:10.710 --> 09:12.840
Press s to suspend the operation.

09:13.650 --> 09:14.070
Ten.

09:14.220 --> 09:17.640
Type the following and press enter dollar computer.

09:17.640 --> 09:19.410
Name 11.

09:19.560 --> 09:22.620
Type the following and press enter exit.

09:23.500 --> 09:23.980
12.

09:24.130 --> 09:26.530
Press y 13.

09:26.710 --> 09:28.420
Type the following and press enter.

09:29.260 --> 09:30.760
Remove module my tools.
