I have a question i'm trying to basically write a script to gather server roles information remotely from my pc. i have administrative rights not the server since its just a dummy test server.
What i currently have is the initial cmd :
servermanagercmd.exe -query roles.xml
What i need help understanding is :
How to initialize a connection to the server (My server is a MS 08 R2 64-bit) with remoting enabled.
via Enable -PSRemoting -Force. "As i'm sure i need to pass my login info in the cmd some how to be allowed to run the cmd im passing.
Sending the cmd to the server servermanagercmd.exe -query roles.xml
Related
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?
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.
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.
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.
I can execute the following command on a specific machine and it can return a list of processes on several target computers but returns a "Couldn't connect to remote machine" error on one machine.
get-process -ComputerName 192.168.1.101
None of the target machines have powershell installed.
The machine I am executing the powershell script on has 2.0 installed.
I have admin privileges on all machines.
The target machines that are able to return a list of processes remotely are server 2003 Standard Edition with SP 1.
The target machine that does not return a list of processes remotely is server 2003 R2 Standard Edition SP2.
What would prevent me from getting a list of processes from a remote machine using powershell?
It turns out the machine that was returning the error did not have the Remote Registry service started. Once I started this service the "Couldn't connect to remote machine" error went away. This blog post helped me find the solution http://sebastienlachance.com/post/ProcessGetProcesses-common-errors.aspx
I think it uses WMI, so if the service isn't running, that would do it. Can you execute Get-WMIObject queries against those PCs at all?