Questions tagged [powershell-remoting]

The ability to create a remote connection, in an other way than using WMI, is the most important difference between PowerShell v 1.0 and 2.0.

Host applications can use a PowerShell object to run commands that use WS-Management-based Windows PowerShell remoting to create a temporary or persistent connection to the remote computer. This includes establishing an interactive session with a single remote computer.

1238 questions
4
votes
1 answer

Passing variables to a PoSh remote file to execute

I am trying to run a PS Remote session from Machine A to access Machine B. Both are on the same domain and Kerberos authentication is working and I can establish a PS Remote session. I am trying to run a script from Machine A on MAchine B passing…
stack72
  • 8,198
  • 1
  • 31
  • 35
4
votes
3 answers

powershell bitstransfer object reference not set to an instance of an object

i have a program written in C# that uses powershell bitstransfer to upload and download a file from a machine. its been working fine until today when the upload and download stopped working giving this error. It seems like the error is local to my…
user1158903
3
votes
3 answers

Execute remote quiet MSI installs from Powershell

I am trying to use the Invoke-Command powershell cmdlet to install a MSI installer. From within powershell on the local machine and from the proper directory, the following works: ./setup /quiet The following does not seem to work: $script = { …
PatrickV
  • 2,057
  • 23
  • 30
3
votes
2 answers

WinRM and powershell modules written with .NET framework 4

I have successfully connected to a remote powershell session through WinRM. It works like a charm. Problem begins when I try to import a module which uses an assembly built for .NET framework 4. When working locally had the same problem but was…
santi
  • 487
  • 2
  • 4
  • 10
3
votes
3 answers

Powershell Remote DIR Command Ouput to Remote Server

I dont understand what is wrong. If I run this command in command prompt dir /S/B | findstr "test" > \\server-name\c$\results.txt It works fine. But If I try running it thru powershell on a remote computer $result =…
Me Myself
  • 129
  • 2
  • 14
3
votes
2 answers

Catch RPC Server Unavailable Error HRESULT: 0x800706BA

In powershell, I can catch Access is Denied error using Catch [System.UnauthorizedAccessException]. How do I similarly catch RPC Server Unavailable error?
SeanFromIT
  • 644
  • 1
  • 9
  • 18
3
votes
1 answer

[System.IO.Path]::GetTempPath() outputs local temp directory when called through Invoke-Command on a remote machine

I'm running PowerShell commands on a remote machine by the use of Invoke-Command -ComputerName. I'm trying to obtain the path of the temporary directory of the remote machine. Depending on where I call [System.IO.Path]::GetTempPath() it either…
zett42
  • 25,437
  • 3
  • 35
  • 72
3
votes
1 answer

Invoke Powershell 7 commands in Hyper-V VM without Admin

I'm trying to use Powershell to remotely perform actions within a Windows 10 Hyper-V VM from the Windows 11 host. These actions must: Be run in the guest OS using Powershell 7 Be run in the guest OS without administrator priviledges (runas…
ibebbs
  • 1,963
  • 2
  • 13
  • 20
3
votes
2 answers

Is it possible to create a function only for a catch block?

I have multiple try catch blocks and all of them are using the same catch block. try { invoke-command -cn $host -Credential $cred -ScriptBlock { param($name) statement... } -ArgumentList $name …
meallhour
  • 13,921
  • 21
  • 60
  • 117
3
votes
1 answer

New-PSSession using python only (no subprocess module)

I wanted to know if it was possible to use New-PsSession and Invoke-Command to an exchange server using python only? I am doing testing and DON'T want to use the subprocess module but instead wanted to know if there are any python modules that can…
3
votes
3 answers

Powershell doesn't have access to a network share

I use powershell to check if the ports are opened on my computers. I got 8 windows 2008 R2 machines and I run the following script : $localhost = get-content env:computername foreach($port in get-content "\\computer1\txtfiles\ports.txt") { foreach…
alex
  • 916
  • 4
  • 12
  • 26
3
votes
1 answer

New-PSSession fails remotely, works locally

Remote PC: Windows 10 Client My PC: Windows 10 Client On the remote PC: I can open the PSSession by running the PowerShell as an administrator and using the command New-PSSession -EnableNetworkAccess if I don't add the -EnableNetworkAccess…
hensonpard
  • 31
  • 3
3
votes
0 answers

How to get full language mode when remoting

I'm performing some powershell remoting. The systems in question have SMB access disabled, so I can't use direct access to the files in question. As a result, I've been using the ps session to copy files. $remote_session = New-PSSession…
Tim Brigham
  • 574
  • 1
  • 6
  • 24
3
votes
1 answer

Adding multiple line at the end of the file using powershell

I am trying to add multiple line at the end of the file using powershell. for example : The file is already present and have some content in it. abc.txt abc def ghi jkl mno pqr So abc.txt file looks like something I have mention above. Now i am…
3
votes
1 answer

PowerShell script failure on remote execution

On executing a PowerShell Remote Script I am getting an error like following Invoke-Command : Exception calling "ToXmlString" with "1" argument(s): "The requested operation cannot be completed. Th e computer must be trusted for delegation and the…
RinoTom
  • 2,278
  • 2
  • 26
  • 40