copy-item to User's Desktop?

Posted on 2013-09-09
Medium Priority
1 Endorsement
Last Modified: 2013-09-09
What's the syntax to copy \\theserver\someshare\thisfile.txt to the current user's desktop?

I am executing the script by first doing this:

set-location \\theserver\someshare\

then running .\thescript.ps1
Question by:DrDamnit
LVL 40

Expert Comment

ID: 39478487
Try by setting destination to "$env:USERPROFILE\desktop"
LVL 29

Accepted Solution

becraig earned 2000 total points
ID: 39478489
$desktop = [Environment]::GetFolderPath("Desktop")

copy-item \\theserver\someshare\ $desktop

Featured Post

We Need Your Input!

WatchGuard is currently running a beta program for our new macOS Host Sensor for our Threat Detection and Response service. We're looking for more macOS users to help provide insight and feedback to help us make the product even better. Please sign up for our beta program today!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question