Q:

Empty folders when using Copy-Item Network Drive to Local Drive

I'm currently using this Powershell script 
Function Copy-ItemUNC { 
    New-PSDrive -Name "B" -PSProvider "FileSystem" -Root "\\ServerName\serverupdates\deploy\Program Files\"  

    Copy-Item -Path "\\servername\serverupdates\deploy\Program Files\*" -Destination 'C:/Program Files'; 
} 

When I run the script it creates the folders but there are no subfolders within them. 
Second problem I have is that I have to manually open Windows Explorer and type in the path to connect to it first in order for this script to even run. Is there a way to fix that too? 

A:

It's because you are not asking for subdirs, as that requires you to do this.
Copy-Item -Recurse

-Recurse <SwitchParameter>
    Indicates that this cmdlet performs a recursive copy.

    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       False
    Accept wildcard characters?  false

(Get-Command -Name Copy-Item).Parameters.Keys
Get-Help -Name Copy-Item -Full
Get-Help -Name Copy-Item -Examples

This command copies the mar1604.log.txt file to the C:\Presentation directory. The command does not delete the original file.
Example 2: Copy the contents of a directory to another directory
PS C:\>Copy-Item "C:\Logfiles" -Destination "C:\Drawings" -Recurse

So, this line should be like this..
Copy-Item -Path "\\servername\serverupdates\deploy\Program Files\*" -Destination 'C:/Program Files' -Recurse

You also do not really need this..
New-PSDrive -Name "B" -PSProvider "FileSystem" -Root "\\ServerName\serverupdates\deploy\Program Files\"  

... based on what you are after. Especially since you are not using it anywhere in your code. That semi-colon is also not needed.

