Questions tagged [copy-item]

Copy-Item is a powershell cmdlet that copies an item from one location to another.

Copy-Item is a powershell cmdlet that copies an item from one location to another in the same namespace. For example, it can copy a file to a folder, but it cannot copy a file to a certificate drive.

Copy-Item does not cut or delete the items being copied. The particular items that the cmdlet can copy depend on the Windows PowerShell provider that exposes the item. For example, it can copy files and directories in a file system drive and registry keys and entries in the registry drive.

Copy-Item can copy and rename items in the same command. To rename an item, enter the new name in the value of the Destination parameter. To rename an item without copying it, use the Rename-Item cmdlet.

Output

  • None or an object representing the copied item.
    When you use the PassThru parameter, Copy-Item returns an object that represents the copied item. Otherwise, this cmdlet does not generate any output.
282 questions
0
votes
1 answer

powershell copy-item all files from harddrive to another harddrive

This is what I have but keep getting following error. I am using Windows 7 Home Premium 64bit. I need to copy everything from my laptop hard-drive to desktop K:\Mybackup folder. $source = "M:\" $dest = "K:\MyBackup" Copy-item $source $dest…
torres
  • 1,283
  • 8
  • 21
  • 30
-1
votes
1 answer

Powershell functions copy-item error-exception with 2 parameters

Here is my question; $source = "\\Somewhere\Overtherainbow\something.exe" $destinationSource = "C:\temp" Function MyCopyFunction([string]$from, [string]$to) { $src= $source+$from $dest = $destinationSource+$to Copy-Item -Path $src…
Ahhzeee
  • 123
  • 1
  • 12
-1
votes
1 answer

Power shell copy item search on selected files recursively and copy only file to destination folder

I want to fetch a specific file recursively which may exists in sub-folders and copy it to destination folder. I tried executing below command: Get-ChildItem "D:\Source Directory" | Copy-Item -Destination "D:\Target Directory" -Recurse -filter…
svevis
  • 21
  • 2
-1
votes
1 answer

Powershell: Find the currently logged on user and copy a unique file from a shared drive

Title says most of it. I have generated unique files for users who will be running their scripts remotely. The script is supposed to find the name of the currently logged on user and copy that unique file to C:\Users\Public. Currently however I am…
staz
  • 13
  • 1
  • 5
-1
votes
1 answer

copy directory to remote computer using powershell

I'm a beginner and i tried to make a simple script to save our current scripts on other admin computer. So: $SAVE = Get-ADComputer -filter " name -notlike '* *mycomputer*' " -SearchBase 'OU=Supervision,OU=...' Foreach ($S in $SAVE) { Copy-Item…
-1
votes
2 answers

PowerShell script isn't copying like I want

Right in the beginning I should note that I am a bloody beginner because I can't attend it classes in my grade. I want to create a PowerShell script which will copy everything from C:\Users\Robert\Desktop\test(lots of…
weda
  • 11
  • 2
-1
votes
1 answer

Copy-Item to networkpath: incorrect user name or password

I have a PowerShell v1 script, that is triggerd by a PLC. It should copy a file from the desktop of the embedded PC to a network path. If I run the script manually it works just fine, but if the script is triggered by the PLC I will get the…
hen-ling
  • 1
  • 1
  • 2
-1
votes
3 answers

Copy files from UNC path to C:\ and Program files (x86) folder within a remotly generated New-PSSession

I am writing a script, that creates a new VM, connects to it via New-PSSession and runs serveral Commands to alter a few settings and copy folders from a UNC path to the local C: and C:\Program files (x86). Everything works fine expect the copy part…
Kuroda
  • 1
  • 1
  • 2
-1
votes
2 answers

Copy-item in foreach loop based off metadata

In this script I identify the metadata for a group of pictures, then run an if statement inside a foreach loop to copy all pictures from one folder with a certain date to a new directory with that date. My problem is with Copy-Item, or so I think.…
user73834
  • 3
  • 2
-1
votes
1 answer

Difference between Power Shell cmdlets Copy-Item and Start-Bitstransfer

Could someone please explain what is the difference between Power Shell "Copy-Item" and "Start-Bitstransfer" cmdlets ? I'm going to use one of these cmdlets to copy a file from remote share to my local machine. I now that both of them can be run…
AnnaL
  • 111
  • 7
-2
votes
1 answer

how to copy folders from one location to another excluding files in the folders

I have to copy only folders from one location to another location on file system excluding the files inside the folders. The below snippet i have tried is copies folders and files Ex: MoveToPath\A\B\X.xml. Copy-Item $MoveFromPath $MoveToPath…
mak
  • 11
  • 3
-3
votes
1 answer

How can I use PowerShell to copy a range of files where the file name is as sequence of numbers

How can I use PowerShell to copy a range of files where the file name is as sequence of numbers? For example, say I have a bunch of files where the names are numbers starting at 23540987577 to 27495847547388. However I only want to copy files where…
1 2 3
18
19