powershell-remoting

Is it possible to send 'out of band data' from a remote Invoke-Command call?

爱⌒轻易说出口 提交于 2019-12-13 05:20:40
问题 I have a system in which I'm remoting into a single machine at a time and running commands, scripts, etc. It would be useful to be able to effectively return log messages from the remote script in "realtime". Some code to get an idea of what I'm trying to do. Note that both the local Log-*Msg functions log to a database (and tee to standard out/err as appropriate). Also note that we have analogous Log-*Msg methods on the remote side (loaded from a module) that are meant to pitched back across

Powershell 3.0 Importing binary module from remote share

自古美人都是妖i 提交于 2019-12-13 04:49:13
问题 There are two machines in this scenerio: client.sub.domain.com (client machine PSRemoting to remote server) server.sub.domain.com (remote server that client is PSremoting into) I am using the below commands to start a psremote session using CredSSP to do "second-hop" authentication: $session = New-PSSession -cn server.sub.domain.com -Credential $credential -Authentication Credssp Invoke-Command -Session $session -ScriptBlock {. '\\client\Profile\Microsoft.PowerShell_profile.ps1'} Invoke

How to create a local windows user account using remote powershell?

 ̄綄美尐妖づ 提交于 2019-12-12 15:46:08
问题 tried creating users with powershel.This worked fine for local machine. But how to create a local user account in a remote machine using remote powershell? The script localwindows.ps1 is $comp = [adsi]'WinNT://machinename,computer'; $user = $comp.Create('User', 'account4'); $user.SetPassword('change,password.10'); $user.SetInfo(); I tried the same thing through C# : PSCredential credential = new PSCredential(userName, securePassword); WSManConnectionInfo connectionInfo = new

powershell remoting: very slow

a 夏天 提交于 2019-12-12 11:14:42
问题 If I ssh from a solaris Server to a US server, the ssh connection is very fast, such as delete a file can complete very soon. But why powershell remoting is so slowing, after I entered the remote session, and then remove an item, it takes more than 10 seconds to complete. Enter-PSSession -computerName test remove-item 'C:\20010101.xls' running the following command also takess more than 5 seconds. [Environment]::UserDomainName + "\" + [Environment]::UserName+" on"+[Environment]::MachineName

PowerShell - executing a script on a remote machine giving error

自闭症网瘾萝莉.ら 提交于 2019-12-12 10:57:07
问题 This following is not working for me - %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command "& Invoke-Command -ComputerName "Spider_LT_86" -ScriptBlock { msiexec.exe /i "D:\3PDInstallers\ETLBackgroundWorkerSetup.msi" /qn /l*vx "D:\3PDInstallers\logs" }" all I need to do is run msiexec on a remote machine. I am assuming that the user running the script will have required access to the remote machine. The script doesn't work even when the Computername

TFS 'Powershell on Target Machines' task for machines in different AD domain

喜欢而已 提交于 2019-12-12 05:38:26
问题 We want to utilize TFS release management for our deployments. We have several environments (dev, qa, staging, prod). Each of them in separate AD forest. Build machine also resides in separate forest. No trust between them. I set up target machines to accept CredSSP authentications for PS remoting. I was able to enter PS session on target machine from build machine. But no luck from TFS task 'Powershell on Target Machines'. Here how my tasks looks in TFS: TFS PS on Target Machines task In

Running Remote Powershell Commandlet that wraps a process exits before completion

核能气质少年 提交于 2019-12-12 04:48:53
问题 I have a custom PowerShell commandlet that I have created in C# that spins up some instances of vstest.console.exe and publishes the test results to a .trx file or to tfs. This commandlet works in isolation when using PowerShell locally. However when I run the commandlet remotely using v3 PowerShell remoting, The invoke-command completes, but there are 2 issues: The test run process does not complete as there is no results file published I do not get the results on the remote console, whereas

How to store data from foreach function in HTML file in powershell and get Physicall ram

不羁岁月 提交于 2019-12-11 23:57:34
问题 I have written a for each file which stores the BIOS information of the systems in a network and the result is being displayed on my console but I want them to be in a HTML file in an order. Code: $arrComputers = get-Content -Path "C:\Computers.txt" foreach ($strComputer in $arrComputers) { $colItems = get-wmiobject -class "Win32_BIOS" -namespace "root\CIMV2" ` -computername $strComputer foreach ($objItem in $colItems) { write-host "Computer Name: " $strComputer write-host "BIOS Version: "

PowerShell Remoting error with TFS build Visual Studio Test Agent Deployment task

人走茶凉 提交于 2019-12-11 18:37:59
问题 I'm working on integration of automated UI functional tests into non-XAML TFS build. My build definition specifies the following build steps: - Get Sources - NuGet Installer - MSBuild - Windows Machine File Copy - Visual Studio Test Agent Deployment - Run Functional Tests The first four steps complete successfully. Step 4 (Windows Machine File Copy) copies our test project application folder contents from our build server to another remote VM, hosting our Test Agent. The intention is to

My status won't update and it keep pulling from the previous status

…衆ロ難τιáo~ 提交于 2019-12-11 17:30:01
问题 Here my script, basically it refreshes service, everything is working fine until that last status check after Start-Sleep 25 . It keeps pulling the first status that it received (I have couple check status in this script and it uses the first status instead of rechecking it). For example, if the service is offline and it will use the first offline status that was acquired when checking for the first time and display it after the service have been turned on. Any way to show have the script