Question on Move-Item Internals

Welcome Forums General PowerShell Q&A Question on Move-Item Internals

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
1 week ago.

  • Author
    Posts
  • #165328

    Participant
    Topics: 1
    Replies: 1
    Points: 37
    Rank: Member

    We have installed a new Windows server and Move-Item is not functioning. I believe the issue to be firewall related and would like to know what Protocols and TCP ports Move-Item uses.

    Any Help?

    Thanks,

    -Steve

  • #165343

    Participant
    Topics: 1
    Replies: 50
    Points: 268
    Helping Hand
    Rank: Contributor

    When you say its not working...are you getting an error message? What's the code you're executing. Depending on how you write it can use SMB or the WinRM ports.

    This link will show you to use WinRM (ala invoke-command) to copy files.

    https://blog.ipswitch.com/use-powershell-copy-item-cmdlet-transfer-files-winrm

    • #166063

      Participant
      Topics: 1
      Replies: 1
      Points: 37
      Rank: Member

      I was going to try this without "Plowing Corn", but seeing your question, here goes:

      The Error message returned is: "move-item : The specified network name is no longer available."

      Get same error with Copy-Item also.  Our corporate security group tells me that they have port: SMB/CIFS TCP port 445 Open point to point.

      The source server is physical Windows Server 2016. The Destination is a Hitachi HNAS unit with this specific share presented as Both: NFS and SMB.

      What is really Odd is that using: Windows File Explorer on the Source server, I can access the Destination share. I can store, retrieve, and delete files.

      So I believe our internal Firewall has SMB open. Evidently Move-Item Must be using a different protocol.  I will read the post/blog link that you sent me.  Thanks for that.  Any additional thoughts?

      -Steve

      Missed your Question on what code I'm Running. For debugging purposes I have this down to a simple command entered from in a PowerShell window as follows. Only the company specific information has been changed for this posting:

      PS C:\Users\mylog> move-item -Path F:\LOCAL-SOURCE\admin\Test_Move_File.txt -Destination \\DEST-SERVER\data01_storage\OCA\MyMyMy.csv -Force

      Also I've read the Blog post that you sent. Don't think that will help as the Destination is a NAS box and not a Windows Server.

      -Steve

       

    • #166322

      Participant
      Topics: 1
      Replies: 50
      Points: 268
      Helping Hand
      Rank: Contributor

      That is odd, I don't have any experience moving files to a straight NAS, so for now I'm going to ignore that.

      Does the path exist up to the file?

      \\DEST-SERVER\data01_storage\OCA\

       

      Copy-item(and move-item) doesn't like to create folders if you're only copying  a file.

      you could try:

      new-item \\DEST-SERVER\data01_storage\OCA\MyMyMy.csv -Force

       

      That will create a 0 byte file BUT it will create the directory structure.  Then try to copy/move the file to the destination

       

You must be logged in to reply to this topic.