standard user running a powershell script

PowerShell execution policy.  I have a user that is a standard user on her computer... no admin privileges.  I have a powershell script that will run for me as an administrator but not for her when she is logged in.  lets say her name is jane doe.   her login is jane.doe with a domain name of dog.

how can i change her privileges to run this certain ps1 script?
Who is Participating?
Nothing that requires specific privileges, assuming she has the required NTFS permissions.
To make it easier for her, you can use a batch wrapper with PowerShell at its core.
Save this as Whatever.cmd; then she can just run it with a double-click:
@PowerShell.exe -Command "Invoke-Expression -Command ((Get-Content -Path '%~f0' | Select-Object -Skip 2) -join [environment]::NewLine)"
@exit /b %Errorlevel%

$src = "z:\"  # change to your source directory
$dst = "C:\Route file"  # change to your destination directory
$latest = Get-ChildItem -Path $src -Filter *.txt -File |
			Sort-Object -Property LastWriteTime -Descending |
			Select-Object -First 1 -ExpandProperty FullName

Copy-Item -Path $latest -Destination (Join-Path -Path $dst -ChildPath recent.txt) -Force
Write-Host "This window will self-destruct in 5 seconds."
Start-Sleep -Seconds 5

Open in new window

What exactly is the problem?
How are we supposed to tell you which privileges to change if you tell us nothing about what the script is doing?
The execution policy, if that what your problem is, can be set per user:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force

Open in new window

Or start the script while telling PowerShell which execution policy to use:
powershell.exe -ExecutionPolicy Bypass -Command "& 'C:\Temp\Whatever.ps1'"

Open in new window

jamesmetcalf74Author Commented:
My user runs this daily so i basically need her to be able to double click the script and have it do the following
this powershell script is grabbing a file from a file share and placing the file on the local machine

$src = "z:\"  # change to your source directory
$dst = "C:\Route file"  # change to your destination directory
$latest = (Get-ChildItem -Path $src -Filter *.txt -File |
    sort -Property LastWriteTime -Descending | select -First 1).FullName

Copy-Item -Path $latest -Destination (Join-Path -Path $dst -ChildPath recent.txt) -Force
jamesmetcalf74Author Commented:
worked like a charm
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.

All Courses

From novice to tech pro — start learning today.