Last active
November 14, 2023 13:04
-
-
Save oliviano/330ce9f99cba1ca7bf27c4f55bbb1af0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NETWORK SHARE | |
### Create a mapped network drive | |
`New-PSDrive –Name “Y” –PSProvider FileSystem –Root “\\10.10.2.100\ofmd_content” –Persist` | |
`New-PSDrive –Name “Z” –PSProvider FileSystem –Root “\\10.10.2.100\ofmd_production” –Persist` | |
### Check for mapped drives | |
`Get-PSDrive` | |
`Get-PSDrive -PSProvider FileSystem` Get's all the logical drive listed | |
### Remove Drives | |
`Get-PSDrive Z, Y | Remove-PSDrive` ( here we are removing both Z and Y ) | |
### `Net use` command alternative. | |
`net use s: \\tower\movies /user:HTG CrazyFourHorseMen /persistent:Yes` Create a drive | |
`net use s: /delete` deletes mounted drives. | |
`net use * /delete` usefull to delete all mounted drives. | |
#### Notes | |
> Mapped network drives. You can use the Persist parameter of New-PSDrive to create Windows mapped network drives. Unlike temporary PowerShell drives, Windows mapped network drives aren't session-specific. They're saved in Windows and they can be managed by using standard Windows tools, such as File Explorer and net use. Mapped network drives must have a drive-letter name and be connected to a remote file system location. When your command is scoped locally, no dot-sourcing, the Persist parameter doesn't persist the creation of a PSDrive beyond the scope in which the command is running. If you're running New-PSDrive inside a script, and you want the drive to persist indefinitely, you must dot-source the script. For best results, to force a new drive to persist indefinitely, add the Scope parameter to your command, and set its value to Global. For more information about dot-sourcing, see about_Scripts. | |
> [Source: Microsoft help page](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-7.3) | |
# DIAGNOSTIC | |
## Test for port open / connectivity | |
`Test-NetConnection -ComputerName portquiz.net -Port 587` use portquiz to check if port 587 is blocked by router/firewall/isp. | |
## Netstat | |
`# Netstat List Process.exe name + IP's associated with it | |
netstat -a -o -n -b` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment