Part Iii

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Part Iii as PDF for free.

More details

  • Words: 298
  • Pages: 1
Part III: Network File Management Introduction: In this exercise you will create a folder share it out to the network and the remove the shared drive from the network, but first I have to explain variables in some detail so that you sill have an understanding of what you typing in and so that in the future you can set your own variables. When ever you add a “$” in front of a world or object you are telling Powershell to remember this value/ variable. This can be numerical, a string (letters), or an object. When creating an object your assigning that variable the properties of something that is inherent to the WMI objects. Think of it as renaming a file (the WMI object) and then modifying if that file is read-write, read, or full control. The file permission are properties of the object that is the file. Now lets begin… Start-Transcript “C:\FileManagementP3.txt Create your directory that you are going to share: New-Item –path “c:\temp\” –itemtype “Directory” To get a list of the currently shared files type the following command: get-WmiObject -class Win32_Share | sort type, name The following commands reveals the WMI.create method and the differing portions of this command: $objWMI = [wmiClass] 'Win32_share' $objWMI |gm -memberType method |format-List The following commands set variable and the finally create the network shared folder: $FolderPath = "C:\Temp" $ShareName = " Temporary " $Type = 0 $objWMI = [wmiClass] 'Win32_share' $objWMI.create($FolderPath, $ShareName, $Type) Verify that you have created the shared folder: get-WmiObject -class Win32_Share | sort type, name The following commands remove the shared drive you just created: $ShareName = "Temporary" $ShareDel = get-WmiObject Win32_Share -filter "Name ='$ShareName' " $ShareDel.delete() Verify that you have removed the shared folder and stop your transcript: get-WmiObject -class Win32_Share | sort type, name Stop-transcript

Related Documents

Part Iii
April 2020 39
Part Iii
April 2020 42
Part Iii
November 2019 49
Viruses, Protists Part Iii)
December 2019 25