I want to connect to a specific set of laptops on our domain remotely. I need to have it log to the C drive, and search out a specific folder, then report back on a specific file contained in the folder.
I have found scripts that have shown me how to locate and show if the path exists, along with a specific file name at the end of the path. I created a test file on my laptop and the script worked flawlessly.
However, I need it to reach out over our domain, log into the target laptop, locate the file and contents then create a report on the findings. This will need to be done over VPN to the devices on our network.
My main issue at this point is finding the commands to invoke PowerShell to log onto the remote computers.
A rough overview on how to remote execute commands with PowerShell.
Enable PSRemoting with Enable-PSRemoting MS docs
Establish a remote connection with Enter-PSSession -ComputerName testserver123.global.local
This opens a prompt of the remote server where you can run commands. Your PS prompt will get a prefix indicating the remote server.
A useful link is here from 4sysops
Related
I need to use my local computer to simulate a test stand which will be on a domain and access a remote computer which is on a workgroup using PsExec. The testing computer is built from an imaging tool. The IP will be the same every time but the name isn't. The process I'm working with was used on an embedded XP system and is now being upgraded to WIN10. I've added network security using GPO and have found workarounds to be able to open the connection but for some reason just trying to run cmd on the remote machine does not work when using the IP, only the name. Using the IP returns the "access is denied" error. I have already added the token filter key to the registry. Has anyone heard of something like this before?
I have a script I'm trying to run but in the meantime I'm just trying to get
psexec \IP_ADDERESS -h -u USER_NAME(this is an admin) -p PASSWORD cmd
edit: I have to keep my computer on a domain but I have a spare that I was able to put on a workgroup with the test system. Running psexec went perfect. It makes no sense why it works for the name and not ip on a domain->workgroup connection and works exactly how I need it to on a workgroup->workgroup connection.
I have a host machine with Hyper-V enabled, and I have a Hyper-V guest running on this machine. Becauze I can't drag&drop files to the VM, I wrote a script to do this for me, which is integrated in TotalCommander, and which uses Copy-VMFile.
My problem is that the PS script works only if I run it as admin, otherwise I get the error "You do not have the required permission to complete this task."
Why do I need admin to copy from the host machine to the guest OS? And is there a way, some policy which would allow me to circumvent this? It is annoying to enter a password every time I want to copy some files.
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
In regard to Uptime.
I want to install the agents on solaris machine remotely through putty.
Now for that, I have established(logged in) a connection to that system successfully.
following this, my next step would be to "Using a file transfer method such as FTP, transfer the archive containing the Agent to the system on which you want to install it. You should copy the archive to a temporary directory on the system."
Now my problem is that i am unable to transfer the archive containing the agent, to the system on which i logged in through putty.
I have searched this command to transfer the files rcp machinename:source destination
here my machine name is:
\uptime-share.uptimesoftware.com\css\Releases\Agents\Solaris
source : uptimeagent-7.2.1-solaris-sparc
destination : 172.20.98.14/tmp
but after using this command i get the message connection refused.
Could someone help me to do this.
I used this command
rcp 172.20.32.11:/css/Releases/Agents/Solaris:uptimeagent-7.2.1-solaris-sparc 172.20.98.14/tmp
I am a newbie in powershell script. I want to uninstall a service on remote machine and re-install it again. I am able to stop the service, change the files that service is using and again start it.
But, now I want to completely uninstall it.
One more thing, I will be executing these scripts via TeamCity.
I have tried following ways, but each one is giving trouble:
using wmi class
running installutil command on remote machine. But, cant execute this on remote machine since there is problem in accessing that service.
Using Get-WmiObject command and then calling delete() on retrieved service.
Is there any promising solution ??
Any help will be appreciable..
After playing a lot with TC and many commands, finally I got my answer to uninstall a service on remote computer, and its working properly.
I have made use of "wmic" command and provided the remote computer name, username and password for /node:, /username:, and /password: parameters. And, provided 'installutil.exe' command to be executed remotely. Here, the actual command is..
"wmic /NODE:$serverName /USER:$userName /PASSWORD:$password process call create '$path_to_installutil_exe\installutil /u $exe_location_path_of_service'"