I am currently writing a Powershell script (and learning it as I go along) to build a Windows 7 PC (users, applications, printers, etc) and am running into an issue with -recurse not running as I expected it. I need to change the desktop for our user accounts. First I delete anything currently in the Desktop folder, then copy over what we need on the desktop -
Remove-Item \Users\automotive\Desktop\*.* -recurse -force
Copy-Item E:\"Desktop Automotive"\*.pdf C:\Users\automotive
Copy-Item E:\"Desktop Automotive"\Desktop\*.* C:\Users\automotive\Desktop -recurse
Remove-Item \Users\phoenix\Desktop\*.* -recurse -force
Copy-Item E:\"Desktop Phoenix"\*.* C:\Users\phoenix\Desktop -recurse
The Remove-Item commands work fine and the first Copy-Item command works, because it's simply copying over two needed .pdf files. However, the other two Copy-Item commands are not working as expected - they copy over the items found in the E:\ drive folder to each Users respective Desktop folder on the C:\ drive, but they are not copying over numerous sub-folders, which is what I expected -recurse to do for me.
What am I missing?