Share via


Access shared drive via Command prompt

Question

Tuesday, September 17, 2019 3:56 PM

I am trying to access a file on a shared drive on the network. When I try to access it via command prompt I get the error the username of password is incorrect. The share has everyone having full control. When I try using the unc path I get an error that the username or password is incorrect. What do I need to do to fix this?

All replies (13)

Tuesday, September 17, 2019 4:13 PM

Hello,

What commands are you using when trying to access the shared drive?

Method 1

Open a Command Prompt (non-administrator) and map the network drive and then access the shared drive:

net use X: \\SERVER\Share
cd X:

Method 2

If you don't to map a network drive, you can access a UNC Path directly from the Command Prompt using pushd:

pushd \\SERVER\Share

Best regards,
Leon

Blog: https://thesystemcenterblog.com LinkedIn:


Tuesday, September 17, 2019 5:10 PM

So if I am trying to run a script that is located in the share how would I do that using the command prompt/powershell?


Tuesday, September 17, 2019 5:22 PM

If you're using PowerShell, you might have to configure the Execution Policy by using the Set-Executionpolicy cmdlet.

You can get the current execution policy with the following cmdlet:

Get-ExecutionPolicy

To run a PowerShell script from a network share:

\\SERVER\Share\Script.ps1

To run a Batch script from a network share

\\SERVER\Share\Script.bat

Blog: https://thesystemcenterblog.com LinkedIn:


Tuesday, September 17, 2019 5:42 PM

when I use script \unc path it tells me the user name or password is incorrect.


Tuesday, September 17, 2019 5:53 PM

Show the command your using.

Blog: https://thesystemcenterblog.com LinkedIn:


Tuesday, September 17, 2019 5:56 PM


Tuesday, September 17, 2019 6:04 PM

Run it like this:

cscript "\\192.168.1.13\PXE Share\Scripts\LiteTouch.vbs"

Blog: https://thesystemcenterblog.com LinkedIn:


Tuesday, September 17, 2019 6:07 PM


Tuesday, September 17, 2019 6:09 PM

You need to remove the single quotes around the PXE Share

From:

cscript "\\192.168.1.13\'PXE Share'\Scripts\LiteTouch.vbs"

To:

cscript "\\192.168.1.13\PXE Share\Scripts\LiteTouch.vbs"

Blog: https://thesystemcenterblog.com LinkedIn:


Tuesday, September 17, 2019 6:12 PM

I am getting the same error.


Tuesday, September 17, 2019 6:26 PM

Are you running this with a domain user?

Is your computer joined to a domain?

Does it belong to the same domain as where the script is located?

Blog: https://thesystemcenterblog.com LinkedIn:


Tuesday, September 17, 2019 6:28 PM

The computer is not on the same domain where the script is located. Do I need to specify the un/pwd when trying this?


Tuesday, September 17, 2019 6:34 PM

There's your issue..

Since your question is more related to scripting and not share problems, you would be better off asking the scripting experts in the scripting forums over here: Scripting > The Official Scripting Guys Forum!

Here's also something that may help:
How can I run this .vbs on another domain computer?

Blog: https://thesystemcenterblog.com LinkedIn: