Autoit Script to start Powershell on remote server using Teamviewer Session - powershell

I am trying to automate the access process using teamviewer session. I have to kick Powershell script kept on remote server using autoit script and problem i am facing is autoit not recognizing the remote connection. Below is one i tried.. Running Teamviewer from my local and authenticating the server using TV session ID and password and once i logged in kicking powershell console to execute the script.
Run("C:\Program Files (x86)\TeamViewer\TeamViewer.exe")
WinWaitActive("TeamViewer")
Sleep(5000)
Send("213322822")
Send("{TAB}")
Send("{TAB}")
Send("{ENTER}")
sleep(2000)
WinWaitActive("TeamViewer Authentication")
Send("abcd#123",1)
Send("{ENTER}")
Run("C:\system32\WindowsPowerShell\v1.0\powershell.exe")

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?

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

Can't execute MSTest through powershell remote session

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?

run a .bat file without being logged in to windows account

I would like to connect my dial up broadband pppoe when my system starts without logging into my account on windows 8.1, I have successfully running some other programs like team viewer apache, mysql, filezilla server using windows task scheduler. SO i have also created a .bat file using rasdial to connect my dialup connection the code is
rasdial connection_name username pass
rasdial connection_name /d
rasdial connection_name username pass
this works fine when I double click on it but it is not working with windows task scheduler but why?

Need to run command on a remote server with no access to remote desktop

As the title describes I need to run a command on a remote server and I do not have access to remote desktop! I head that this should be possible using Powershell, but I can't find any good tutorials on this.
Recommendations?
The easiest way is to use psexec.exe (Part of Microsoft Sysinternals).
You can also use powershell.
I wrote a blogpost about these two alternatives a few days ago:
http://blog.degree.no/2012/03/executing-commands-and-programs-on-a-remote-machine-using-powershell/
When using PSEXEC or PowerShell remoting you can execute a command on a remote machine, but it is not interactive with any currently logged on user. Using PowerShell requires 2.0 to be installed on your machine and remotely AND remoting must be enabled AND you must have admin rights on the remote computer.