powershell-remoting

How can I get 7za.exe to run via Powershell Remoting?

我们两清 提交于 2019-11-30 03:52:23
I've tried a number of different ways to do this, they all result in the same error. Here is one set of commands: $s = New-PSsession -ComputerName ServerA $job = Invoke-Command -Session $s -Scriptblock { Start-Process -FilePath "C:\Scripts\ArchiveEventLogs\ver4.5\7za.exe" -ArgumentList "a", "C:\Scripts\Eventlogs.bak\ServerA-20101111.7z", "C:\Scripts\Eventlogs.bak\*.evt*", "-mx7", "-oC:\Scripts\Eventlogs.bak", "-wC:\Scripts\Eventlogs.bak", "-t7z" -Wait } -AsJob Get-Job | Wait-Job Receive-Job Job$ The output I get is this: 7-Zip (A) 9.17 beta Copyright (c) 1999-2010 Igor Pavlov 2010-10-04

Enter-PSSession to remote server fails with “cannot find the computer”

会有一股神秘感。 提交于 2019-11-30 00:42:43
问题 My desktop is win7 and I am trying to connect to a server 2012. Both hosts are on the same domain. If I do: Enter-PSSession -ComputerName *ServerName*** I get the following failure message from winrm Enter-PSSession : Connecting to remote server xxx failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer xxx. Verify that the computer exists on the network and that the name provided

Run my third-party DLL file with PowerShell

亡梦爱人 提交于 2019-11-29 23:01:50
I am not sure if this is possible or not with PowerShell. But basically I have a Windows Forms program that configures a program called EO Server. The EO Server has an API, and I make a reference to EOServerAPI.dll to make the following code run. using EOserverAPI; ... private void myButton_Click(object sender, EventArgs e) { String MDSConnString="Data Source=MSI;Initial Catalog=EOMDS;Integrated Security=True;"; //Create the connection IEOMDSAPI myEOMDSAPI = EOMDSAPI.Create(MDSConnString); //Get JobID Guid myMasterJobID = myEOMDSAPI.GetJobID("myJobRocks"); } Is it possible to interact with an

Does powershell remoting support version of the powershell to be used on remote target?

被刻印的时光 ゝ 提交于 2019-11-29 13:05:13
Can I supply a version of powershell to be used on the target machine while ps remoting. May be my question is not proper or not possible to answer but if any body having idea please help me. I am trying to do a remoting using powershell on a machine where powershell 2.0 3.0 and 4.0 versions are available , but I want to use the version 4.0 only (on target machine) is it possible? Thanks Gyan Yes, there is a way to connect to a specific version of Powershell on a remote machine. It does require changes to be made on the remote machine though. When you use Powershell remoting to make a

How to check if a Powershell script is running remotely

我只是一个虾纸丫 提交于 2019-11-29 10:54:55
I have a script that can be run either locally or remotely (via WinRM), however I would like it to behave slightly differently when run on a remote machine. I realise that I can pass in a switch to the script to identify whether it is running locally or remotely, but I want to know if it is possible for the script itself to detect whether it is running remotely? Get-Host returns, amongst other information a Name : PS> (Get-Host).Name ConsoleHost PS> (Invoke-Command -ComputerName dev2 -Script {Get-Host}).Name ServerRemoteHost if ($PSSenderInfo) { "Running remote" } else { "Running local" } Rob

Launching background tasks in a remote session that don't get killed when the session is removed

柔情痞子 提交于 2019-11-29 09:47:47
I have been using PsExec -d to launch console applications in a remote powershell session because I want these apps to run in the background while I perform some task. The problem is that I want the background applications to continue running even if I kill the remote powershell session with Remove-PSSession . What happens currently is once the remote powershell session is killed so are all the processes that were started with the help of PsExec -d . I'm guessing it has something to do with process trees and how windows manages the lifetime of such things. Does anyone have any idea how I can

“get-wmiobject win32_process -computername” gets error “Access denied , code 0x80070005”

喜夏-厌秋 提交于 2019-11-29 00:07:01
i'm trying to find processes on 3 terminal servers which have certain words in its $_.commandline property. Under my domain admin account, it worked OK. But I want this script to be usable for domain users, and doamin users get an error when runing this script. What should i do, so that domain users can run this script just like domain admins? Thanks in advance! Error: Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESS DENIED)) At N:\FindWhoIsUsing\FindWhoIsUsing.ps1:7 char:18 get-wmiobject <<<< win32_process -computername $server -EnableAllPrivileges| CategoryInfo

Powershell Remoting Profiles

ⅰ亾dé卋堺 提交于 2019-11-28 19:00:44
How do I use a function in my profile on the remote machine when using Enter-PSSession on my local machine to open a remote PowerShell session. You can't. When starting a remote interactive session with enter-pssession, a remote profile is loaded. Additionally, only the machine-level profile in $pshome is loaded. If you want remote functions available you'll have to initialize them in the startup script of the remote session configuration. Have a look at get/set-pssessionconfiguration on the remote server. Kiquenet By JonZ and x0n: When you use pssessions with the default session

How to import custom PowerShell module into the remote session?

烈酒焚心 提交于 2019-11-28 17:13:13
I'm developing a custom PowerShell module, which I'd like to use in context of a remote session to a different computer. The following code (which obviously doesn't work) explains what I'm trying to achieve: import-module .\MyCustomModule.psm1 $session = new-pssession -computerName server01 invoke-command -session $session -scriptblock { <# use function defined in MyCustomModule here #> } The first question is whether it is at all possible to achieve this scenario? I mean I would only like my custom module to be physically present on my machine, not on remote server. I have found this thread ,

Powershell, remote script access denied to network resources

人走茶凉 提交于 2019-11-28 13:35:22
I am trying to execute powershell script remotely using invoke-command. The script relies on a configuration file which is available over the local network. The script is called in a following way: Invoke-Command -ComputerName 192.168.137.181 -FilePath c:\scripts\script.ps1 -ArgumentList \\192.168.137.1\share\config.xml The configuration as you can see is an xml file and it's loaded using: $xml = New-Object XML $xml.Load(args[0]) When the script is called locally on the machine then it runs witout any problems and reads the configuration file. However when I run it from different machine using