Mounts a network drive to a drive letter.
Evaluation code:
None
Remediation code:
#REQUIRES -Version 2.0
<#
.SYNOPSIS
This script allows an admin to mount a new network drive.
.DESCRIPTION
This script mounts a network drive on clients machines. Script will not
execute propery if ran in administrator mode. The new drive will be persistant
across reboots.
This is an example script that has been tested to work on Win10 and Win7.
This script may not work on all systems. Modify to fit your needs
.NOTES
File Name :NetworkDriveMount.ps1
Author :Automox
Prerequisite :PowerShell V2 over win7 and upper
#>
#Handle Exit Codes:
trap { $host.ui.WriteErrorLine($_.Exception); exit 90 }
function NetworkDriveMount {
#############Change the settings in this block#######################
$Name="T" #What letter to mount the drive as.
$PSProvider = "FileSystem" # optionally set to Registry to map to reg key
$Path= "\\Readyshare\T_Drive" #where the drive is located
#####################################################################
New-PSDrive -Name $Name -PSProvider FileSystem -Root $Path -Persist
}
NetworkDriveMount