question

AkiyoHiroshi-4362 avatar image
0 Votes"
AkiyoHiroshi-4362 asked DaisyZhou-MSFT commented

Powershell scriptlogon GPO- It runs only for domain admin, but not domain users

Hi everyone,

I have a Powershell script runs as users login. I have tested , It runs if the user is domain admin, but does not run for domain users.

Set-ExecutionPolicy Bypass

$username=$env:username

$date=Get-Date -format M-d-yy-HHmm

$Source= "\\FServer\Sharefolder\$username"

$Destination="\\Fserver2\Sharefolder2\$username"

$Log="\\Fileserver2\Sharefolder3\Temp\Log-$username-$date.txt"

If ($Source-and $Destination) {

ROBOCOPY $Source $Destination "/E" "/S" "/SEC" "/XD" "AppData" /LOG+:log

}

any help is appreciated.


86499-image.png


windows-server-powershellwindows-active-directory
image.png (167.2 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @AkiyoHiroshi-4362,
How are things going on your end? Please keep me posted on this issue.
If you have any further questions or concerns about this question, please let us know.
I appreciate your time and efforts.

Best Regards,
Daisy Zhou

0 Votes 0 ·

Hello @AkiyoHiroshi-4362,
If this question has any update or is this issue solved? Also, for the question, is there any other assistance we could provide?
Thank you for your understanding and support.

Best Regards,
Daisy Zhou

0 Votes 0 ·
DaisyZhou-MSFT avatar image
0 Votes"
DaisyZhou-MSFT answered

Hello @AkiyoHiroshi-4362,

Thank you for your posting here.

If you logon one domain PC using one domain account, can you run the script successfully with this domain user?



Best Regards,
Daisy Zhou

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered

How do you know that it's not running? Have the script create a transcript into a local temp folder and see if you are just getting some error.

 Start-Transcript -path c:\Windows\temp\RemoveSig.log
 ... the script code goes here 
 Stop-Transcript



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AkiyoHiroshi-4362 avatar image
0 Votes"
AkiyoHiroshi-4362 answered

another important question,

The parameter section: -executionpolicy Bypass, is that correct ?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.