Need help trying to allow my remote PowerShell script to run on my Windows 2008 r2 Server
- by Pure.Krome
I've got a Windows 2008 r2 server with Sql Server 2008 r2 installed. I've got a Sql Server Agent which tries to run a Powershell job, but fails :-
Message
Executed as user: FooServer\SqlServerUser.
A job step received an error at line 1 in a PowerShell script.
The corresponding line is '& '\\polanski\Backups\Database\7ZipFooDatabases.ps1''
Correct the script and reschedule the job. The error information returned
by PowerShell is: 'File \\polanski\Backups\Database\7ZipFooDatabases.ps1
cannot be loaded.
The file \\polanski\Backups\Database\7ZipFooDatabases.ps1 is
not digitally signed.
The script will not execute on the system.
Please see "get-help about_signing" for more details.. '.
Process Exit Code -1.
The step failed.
Ok. So i run Powershell on that server then set the execution policy to unrestricted.
To check ..
PS C:\Users\theUser> Get-ExecutionPolicy
Unrestricted
PS C:\Users\theUser>
Kewl :) but it still doesn't work :(
Ok ... what happens when i try to run the powershell from the command line....
PS C:\Users\justin.adler . '\polanski\Backups\Database\7ZipMotorshoutDatabases.ps1'
Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful,
this script can potentially harm your computer.
Do you want to run \\polanski\Backups\Database\7ZipFooDatabases.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
er..... didn't I already tell the server that ANY file can be ran?
Notice the file is located at...
\\polanski\Backups\Database\
So can someone make any suggestions?