Posted On January 6, 2023

Windows: How to Map Network Drive for All Users of a Local Machine

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> Windows: How to Map Network Drive for All Users of a Local Machine
# Mapping file share using legacy commands (more effective than newer PowerShell equivalents in certain scenarios)
$textContent=@'
net use m: /delete
net use m: \\FILESERVER\SHARENAME
'@
Set-Content "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\mountShares.bat" $textContent

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to manually fix a corrupted system file

I've already written a PowerShell Script to perform this task. Search for it within this…

PowerShell: Query Google Account Using GAM

$emailAddress='[email protected]' $field='accounts:last_login_time' function getGamUser{ param( $emailAddress, $field ) $result=try{gam report users user $emailAddress}catch{} if($result){ $headers=$result[0]…

PowerShell: Script to Obtain List of Sites and Associated Domain Controllers

Script: if (!(get-module -name "ActiveDirectory") ){Add-WindowsFeature RSAT-AD-PowerShell; import-module -name "ActiveDirectory" -DisableNameChecking | out-null }$sites=(Get-ADDomainController -filter…