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
8
votes
1 answer

How to use PowerShell and PowerShell modules in the enterprise

Recently, I've joined the Windows team in my enterprise and with my developer background (Java, .NET and Web in general), I was pretty quickly interested in PowerShell. I can see its value over plain old batch files, VB, ... which is why I'd like to…
dSebastien
  • 1,983
  • 2
  • 21
  • 31
8
votes
3 answers

Running Java remotely using PowerShell

When I run PowerShell in a remote session (etsn {servername}), I sometimes can't seem to run Java processes, even the most simple: [chi-queuing]: PS C:\temp> java -cp .\hello.jar Hello Error occurred during initialization of VM Could not reserve…
lmat - Reinstate Monica
  • 7,289
  • 6
  • 48
  • 62
8
votes
2 answers

Functional differences between $PSScriptRoot and $MyInvocation

Problem I am working with Jenkins to deploy PowerShell scripts remotely. As such, I am trying to figure out if there will be problems utilizing $PSScriptRoot over $MyInvocation.MyCommand.Path for getting the current scripts root directory. Details A…
Brandon
  • 731
  • 2
  • 12
  • 29
8
votes
1 answer

PowerShell Access is denied. PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken

I was trying to establish a remote connection to another system and execute some basic commands. Below are the steps that I have done : Configured the remote machine to accept Shell commands - Enable-PSRemoting – Force Tested the configuration on…
8
votes
5 answers

Parameters with double quotes are not properly passed to Scriptblock by ArgumentList

I'm writing generic powershell script to perform deployments on remote machines. I have hit one problem I can not overrun, and this problem is with parameters with double quotes in Scriptblock passed by ArgumentList I have something like…
Midi
  • 459
  • 1
  • 5
  • 19
8
votes
2 answers

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

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 …
bookends
  • 131
  • 1
  • 2
  • 11
8
votes
5 answers

How to check if a Powershell script is running remotely

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…
Paul Bevis
  • 831
  • 1
  • 8
  • 16
8
votes
5 answers

Powershell remoting error - network path not found

I cannot connect to remote server using enter-pssession -computername serverA. My scenario: I have 2 Win 2003 R2 servers in the same domain. ServerA is WSUS server, serverB is a domain controller Both servers have enabled powershell remoting Both…
kubusz
  • 943
  • 3
  • 9
  • 17
8
votes
2 answers

How to remote execute an ELEVATED remote script in PowerShell

I have two servers: serverA (windows 2003 server) serverB (windows 7) ServerA contains a folder with a batch file (deploy.bat) that needs to be executed from an elevated powershell prompt. In ServerA, if I run it from a normal prompt or powershell…
7
votes
1 answer

SSPI sql access fails in remote powershell request due to double-hop failure, constrained delegation

We are trying to run an automated install from serverA on remote serverB which needs to talk to sql serverC using windows authentication. Invoke-Command -ComputerName serverB -ScriptBlock { $conn = new-object System.Data.SqlClient.SqlConnection…
7
votes
1 answer

Powershell 2.0 Remoting loading a .Net 4.0 dll

I am trying to load a .Net 4.0 assembly, using [Reflection.Assembly]::LoadFrom, inside of a remote Powershell 2.0 session. It works locally, due to a change I made to the powershell.exe.config file, but fails with a "This assembly is built by a…
Jared314
  • 5,181
  • 24
  • 30
7
votes
3 answers

New-PSSession to localhost fails

I have a script that opens a remote session to the localhost. I need this to install NuGet on some devices from within a logonscript. $Username = "Admin" $Password = ConvertTo-SecureString ‘adminPW’ -AsPlainText -Force $adminCredential =…
Docschnitzel
  • 175
  • 1
  • 2
  • 12
7
votes
2 answers

Access is denied on copy

I have implemented a script where I'm trying to copy some files on Server A to Server B. Let me explain you the process. I started one loop which is going to run twice and in first execution I'm stopping the app pools and start app pools and than…
7
votes
2 answers

Best practices for writing PowerShell scripts for local and remote usage

What are some of the best practices for writing scripts that will execute in a remote context? For instance, I just discovered that built-in var $Profile doesn't exist during remote execution.
Scott Weinstein
  • 18,890
  • 14
  • 78
  • 115
7
votes
2 answers

To call a powershell script file (example.ps1) from C#

I tried running a script localwindows.ps1 from C# using the following Code : PSCredential credential = new PSCredential(userName, securePassword); WSManConnectionInfo connectionInfo = new WSManConnectionInfo(false, "machineName", 5985, "/wsman",…
cmm user
  • 2,426
  • 7
  • 34
  • 48