Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:42:20+00:00 2026-06-05T14:42:20+00:00

My requirement is to connect to a remote computer, copy files with the extension

  • 0

My requirement is to connect to a remote computer, copy files with the extension of .TRA to a different remote computer.

Now my difficulty arises in that the source machine aren’t on the domain so I need to connect with alternate credentials.

My first sticking point is trying to use New-PSDrive. It doesn’t appear to allow me to pass stored credentials. I have tried various versions of this:

$cred = Get-Credential
New-PSDrive -NAME Z: -PSprovider Filesystem -root \\Computer\Exchange -credentials $cred

and I get an error

The provider does not support the use of credentials. Perform the operation again without specifying credentials.

This appears to be a bug (see halr9000’s comment here : Connecting to a network folder with username/password in Powershell)

My alternative was to use NET USE, which works fine but only once.

In the full script below I map to 8 different machines. The first of these works. After that any attempt to use NET USE (or New-Object WScript.NETWORK, mentioned as a work around on the Technet article linked above) fails. Or rather it doesn’t fail.

Its creates a mapped drive, which I can see if I type NET USE, or if I look in explorer (and its browsable). But I cannot connect to that drive in Powershell. Its like it doesn’t exist, Test-Path Z: returns False. Right up until I run NET USE Z: /D which successfully deletes the drive.

Can someone please help me with one or other of my issues please? Don’t make me do this in DOS!

Full script :

$int = 0
$arrStagePC = "BOX42", "BOX43", "BOX44", "BOX45", "BOX46", "BOX47", "BOX48", "BOX49" 
$arrData = "0848","5144","5292","5383","2158","2646","0061","2331"
Foreach($strComp in $arrStagePC)
    {
    $arr = $arrData[$int]
    $comp = $strComp
    net use z: \\$arr\Exchange /user:admin password
    Copy-Item z:\*$date.tra \\$comp\Export$
    net use z: /d
    $int++
    }

EDIT
Have a look at @Christians accepted answer below. I didn’t actually need to Get-Content that folder, I just needed to copy data from the source so the bit of the script doing the business on there now looks like :

Foreach($strComp in $arrStagePC)
        {
        $arr = $arrData[$int]
        $comp = $strComp
        net use z: \\$arr\Exchange /user:admin password
        Copy-Item FILESYSTEM::Z:\*.TRA \\$comp\Export$
        net use z: /d
        $int++
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:42:21+00:00Added an answer on June 5, 2026 at 2:42 pm

    Using NET USE try access in this way:

     Set-Location  FILESYSTEM::Z:
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one requirement: copy local files to remote system. I have done the
My requirement is that multiple clients need to connect to local HyperSQL 2.2.8 and
I have a code that will connect to a external ASMX service. THe requirement
Requirement : Should update MySQL database with that of MS Sql Server updates which
A requirement to use the RPXNow is to set your Facebook application's connect url
Suppose the requirement for the TCP server that it is connected to a single
I have a standalone application that needs to connect to a Sybase database via
I have a requirement where-in my Silverlight application needs to connect to a WCF
I have some commercial equipment that I can connect to with a .Net library
I have come across a requirement that needs to access a set of databases

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.