powershell-remoting

Powershell Remoting: Use Functions loaded in Powershell remote Profile? [duplicate]

大城市里の小女人 提交于 2019-12-25 08:28:03
问题 This question already has answers here : Powershell Remoting Profiles (5 answers) Closed 6 years ago . Do i get it right that when i have a Profile on a RemoteServer which loads some functions, these functions should be available in a Remote PSSession? My tests weren't successfull, is there a special trick to get this working? I want to refer to Folder on a network share to have all Functions on a single source available. 回答1: When you use pssessions with the default session configurations,

Batch script runs fine, but fails when executed through PowerShell Remoting

本小妞迷上赌 提交于 2019-12-25 04:21:35
问题 I have the following batch script on a Windows 2008 R2 server: @echo off djoin.exe /provision /domain my.domain.com /machine test /savefile savefile.txt echo %ERRORLEVEL% If I run the script on the server itself, either through command prompt or PowerShell, it works perfectly fine and returns "0". The problem is that I need to execute it from a remote computer, so I do the following (an example just for testing): Invoke-Command -ComputerName remotehost -ScriptBlock {.\script.cmd} The output

Unable to query [Get-QADComputer] info in Remote PS Sessions (Powershell)

只愿长相守 提交于 2019-12-25 01:58:00
问题 When i run the below script to extract the OU info using quest ad commandlets it gives me an error as below Object reference not set to an instance of an object. + CategoryInfo : NotSpecified: (:) [Get-QADComputer], NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetComputerCmdlet Below is The Script which is use $password = convertTo-secureString -string "123" -asPlainText -force $credential = new-object

powershell - execute cmdlet remotely with php

…衆ロ難τιáo~ 提交于 2019-12-24 17:50:14
问题 I need to get status of service for simple monitoring tool. There is no problem to get status locally, but when I try to get status of service on remote computer like this: <?php $output = shell_exec('powershell.exe "(get-service Webclient -computername server1).Status"'); echo "Webclient: $output "; ?> I get nothing. WinRM on server1 is set to receive requests and to allow remote access. The Get-Service on remote server1 works fine in console window. This works (locally): <?php $output =

Start-Process doesn't work in powershell remoting

爱⌒轻易说出口 提交于 2019-12-24 16:44:56
问题 I've been trying to to run calculator using powershell remoting. I entered a powershell session (with Enter-PSSession ), and entered the following command: Start-Process calc.exe I looked at the remote computer and nothing showed up. When I try other commands like Get-Process or Stop-Process they work fine. I looked online and saw womewhere that I should try using -PassThrough to see if it's doing anything and I got this result: Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- -

PowerShell Invoke-Command performance issue

白昼怎懂夜的黑 提交于 2019-12-24 15:47:54
问题 There are a few computers on my domain that I have access to remote into with PowerShell. I'm getting extremely slow performance when I remote into a particular computer with a command like this: Invoke-Command -ComputerName someComputerName -ScriptBlock { ls C:\ } -credential myUsername It takes about 10 seconds to display each file/folder on the drive. If I run the same command from within a session using Enter-PSSession then there are no performance issues. Also if I run a command like Get

Powershell Remote Invoke-Command Start-Process App Immediately Closes After Launch

ぐ巨炮叔叔 提交于 2019-12-24 08:31:46
问题 I am working on a script to remotely kill two processes, delete some folders, and launch a service as an application. Eventually this will be deployed to run against multiple servers, but I'm currently testing it against a single server. Everything works great except for the final step which is to launch the remote service (which is being run as an application using the -cl argument due to some compatibility issues with it running as a service). The application launches via the script but

Script to export to excel

非 Y 不嫁゛ 提交于 2019-12-23 12:27:27
问题 I Have below script:-- looking for help to convert the output to excel format $servers = get-content “c:\list.txt” foreach ($server in $servers) { $server $command = “quser /server:” + $server invoke-expression $command } when executed getting in below format the output. server1 USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME Vdw231 ica-tcp#8 7 Active . 11/5/2012 10:40 AM Vdw232 ica-tcp#60 16 Active 16:18 11/5/2012 2:22 PM Vdw233 ica-tcp#71 3 Active . 11/6/2012 6:10 AM Vdw234 ica-tcp#72 1

Why would a get-process -computername return a couldn't connect to remote machine error?

瘦欲@ 提交于 2019-12-22 13:57:11
问题 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

Extremely slow Powershell remote execution?

左心房为你撑大大i 提交于 2019-12-22 12:31:21
问题 Is there any way to speed up powershell remoting? Right now, to execute a "remote" command on my VM, it takes about 30-90 seconds just do do a simple hello world using Invoke-Command with credentials. If I run commands right after that initial execution, I don't get any delay. However, if I wait 3-4 minutes I see a big spike in delay again (30-90 seconds). I've also tried using Enter-PSSession and the same thing happens (for the initial command it's slow, then fast, until I don't issue