HI, can somebody confirm if Powershell plugin can work using remoting in a Jenkins job?
I have a win 2012 box where Jenkins reside and Powershell works fine when executing commands on the machine itself.
I need to do powershell remotely to another win 2012 and issue commands from SQL server Powershell provider, in ISE or powershell command prompt, I run the following
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$cred= New-Object System.Management.Automation.PSCredential ("domain\user", $password )
Enter-PSSession -ComputerName SQL2K12 -Credential $cred
get-command invoke-sqlcmd
I get
invoke-sqlcmd : The term 'invoke-sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\salam\AppData\Local\Temp\hudson2013311959155688202.ps1:8 char:1
+ invoke-sqlcmd -query "sp_databases" -database master
So I did a very basic test to see whther Jenkins powershell is really establishing a remote connection and changed the "invoke-sqlcmd ......" by "ls"
Job worked and in Jenkin's console output, I saw that it has listed the contents of the workspace.
Thanks for your help and confirmation
N.B : I have already posted 3 hours ago in this forum about the same issue, but I think that the test that I have just done has proved something to me and wanted to share with you