Can't execute MSTest through powershell remote session - powershell

I'm unable to execute MSTest on a remote machine from within a powershell remote session, but it works perfectly if I'm logged into that remote machine and run it locally. My guess is that this indicates a permissions issue of some sort, but I have been unable to determine the problem. Here's the 2-liner I use to execute the tests successfully (locally) on the target machine:
PS> $params = #("/testcontainer:MyTests.dll", "/nologo", "/detail:stdout")
PS> & "MSTest" $params
I'm getting the following error when I attempt this through a PSRemote session:
Run has the following issue(s):
Test host process exited unexpectedly.
Failed to queue test run 'username#machinename 2015-08-10 03:30:18': Unable to start the agent process.
Any ideas what might be going on here? I'm using the same credentials to create the PSSession as I use when logging into the target machine with Remote Desktop, but apparently that's no good. Is it possible that because the tests use Selenium ChromeDriver there's some issue with starting a GUI program remotely?

Related

How to Restart a Service Remotely using Powershell on Server 2016

I'm having an issue with the Print Spooler getting hung up on a Hyper-V server that im running and tickets get hung up...Im just trying to streamline this by figuring out how i can just run a powershell script without having to enter any credentials manually. I can get a powershell script to accomplish this but the only one that i have found implements the Get-Credentials and prompts to enter credentials then i get put into a remote Powershell session on the server where i can restart the service from there.
Is there an easier way to accomplish what i am trying to do?

PSS-Remoting problem while connecting to a connection broker to retrieve sessions

Tryin to be synthetic, I'm trying to connecting from a W7 operating system to a connection broker in order to retrieve all of the user's sessions with this simple function:
Get-RDUsersession -connectionbroker 'xx' -collectionname 'xx'
Since I discovered that it can't be done from W7 because the remotedesktop module can't be downloaded even after installed RSAT, some users advise me to use PSSRemoting commands in order to send command on a remote computer where surely the function works and thanks to this way run the entire script i've made on the local computer.
The problem, as you can see in the image attacched, is that it keeps me prompt out this error:
A remote desktop services deployment does not exist on server.se
The same command works on W10 and i'm sure the RDS Deployment exist on that server. I've tried a lot of ways but i can't figure out why it doesn't works.
Someone can help me out ?
You're not really running your command using PowerShell Remoting (H: is not on the remote system as you can see in your screenshot).
Connect to the remote system using:
Enter-PSSession -ComputerName "yourRemoteMachine"
and the run your Get-RDUsersession -connectionbroker "xx" command.

Get host machine name when a script/command is executed powershell Invoke-Command

I have some Powershell scripts for deploying our applications to test machine. These have to be executed using Invoke-Command from the developer machine. Is there anyway to log host machine name/IP from which these scripts are called.
For example:
If developer foo deployed an application using the script from devmachine1 i want to get the name/IP of the devmachine1 and log it in our test machine.
We are using Powershell V4.0. Can upgrade to 5.0 if required.
answering this to mark the question as solved. just incase if some one is looking for an answer.
I am passing computer name $env:COMPUTERNAME as a parameter to the remote script.
Getting the remote username using $PSSenderInfo.ConnectedUser in the remote script.

Checking out code to a remote server via powershell

I am trying to run a batch file that checks out code from a repo. This file is on a different server and i am trying to run it using powershell from my local machine after enabling remoting. when I use Invoke command nothing is returned on my powershell. If i directly try to checkout the code using svn command to the remote server i get svn access forbidden error. Is there a way to resolve this

Execute remote PowerShell script from VSOnline fails - Access Denied

I am facing a very strange issue trying to run a Remote PowerShell script from the new build system of Visual Studio Online.
Context:
I have a Build server that I host on my own VM. I have also created a second VM where I want the PowerShell script to be run on.
When I run a build from the Build server, I want to create a task that run a PowerShell script on a remote machine. Sounds easy.
Both machines have everything configured to run the Remote PowerShell. (I think)
Problem:
If I manually run the script from the build server, the script is properly executed on my remote machine.
But, if I run the script by starting a new build, it doesn't work, I always get an error message
New-PSSession : [xxx.cloudapp.net] Connecting to remote server xxx.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
Have you faced this issue before with VSOnline?
This can happen if there isn't a trust relationship between the remote machine and the build machine. E.g. you could look at the hosts.equiv file on the remote machine and make sure it trusts the build machine.
If that doesn't help then more info might be needed, like how you're trying to sign in, what build agent account you're running as.
Guy