powershell-remoting

PowerShell Core Script deployed as AWS Lambda function fails to remote connect into Windows EC2 Instance using the Commandlet new-pssession

爱⌒轻易说出口 提交于 2021-02-19 07:34:07
问题 AWS Recently announced Lambda Support for PowerShell Core. Reference URL https://aws.amazon.com/blogs/developer/announcing-lambda-support-for-powershell-core/ Followed the steps given in the URL and deployed below Powershell Core script as a Lambda Function. Script: #Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.335.0'} $pw = convertto-securestring -AsPlainText -Force -String "Password" $cred = new-object -typename System.Management.Automation.PSCredential

'Session' Parameter is null or empty in PowerShell script

爷,独闯天下 提交于 2021-02-11 05:28:38
问题 I'm very new to PowerShell (forgive my ignorance) and am trying to install a program remotely on multiple computers on my domain. Currently, I'm just trying to get it to work on one computer. The script below was found online and adapted for my needs. Yesterday it worked, but today it's complaining about the session parameter. I don't fully understand "sessions", but I have ensured on the client machine that the winrm service is running and I have invoked Enable-PSRemoting -force . Here's the

Modifying remote variables inside ScriptBlock using Invoke-Command

假装没事ソ 提交于 2021-02-04 16:06:24
问题 Is it possible to modify remote variables? I am trying to do something like the following: $var1 = "" $var2 = "" Invoke-Command -ComputerName Server1 -ScriptBlock{ $using:var1 = "Hello World" $using:var2 = "Goodbye World" } When I try this I get the error: The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property. So obviously, it doesn't work using this method, but are there any other

Unable to copy a binary to a remote Azure VM

不想你离开。 提交于 2021-01-29 07:52:06
问题 I have a Shavlink agent binary from on-prem(VMWare) that has to be copied across to a Azure VM(s). I used the public VM of the target Azure VM to perform the copy: Copy-Item –Path "C:\ProgramData\LANDESK\Shavlik Protect\Console\DataFiles\STPlatformUpdater.exe" –Destination "D:\Shavlik-Agent\" –ToSession (New-PSSession –ComputerName a.b.c.d) Unfortunately, it gives error as below: New-PSSession : [a.b.c.d] Connecting to remote server a.b.c.d. failed with the following error message : The WinRM

Clickable hyperlink on PowerShell's console output

妖精的绣舞 提交于 2021-01-27 07:09:58
问题 I'm having some issues with the following PowerShell script, could you please help me with that? What I'm trying to accomplish is create a clickable hyperlink in PowerShell's console output. Something like that: $testOutPut = "http://something.com" Write-Host $OutputConvertedIntoHYPERLINK Where the desired console response would be: clickable link to external app http://something.com My goal with it is to show this clickable information on build console into TFS 2015. 回答1: You can't do that

Clickable hyperlink on PowerShell's console output

孤街醉人 提交于 2021-01-27 07:06:14
问题 I'm having some issues with the following PowerShell script, could you please help me with that? What I'm trying to accomplish is create a clickable hyperlink in PowerShell's console output. Something like that: $testOutPut = "http://something.com" Write-Host $OutputConvertedIntoHYPERLINK Where the desired console response would be: clickable link to external app http://something.com My goal with it is to show this clickable information on build console into TFS 2015. 回答1: You can't do that

Run Powershell command from different server

和自甴很熟 提交于 2021-01-07 01:44:01
问题 I have the following powershell command that reads and gives me the status of my .bat scripts depending on the content of .log files : Get-ChildItem *.log | ForEach-Object { [pscustomobject] @{ Name = $_.Name Status = ('FAILED', 'SUCCESS')[(Select-String -Quiet 'Finished with NO errors' $_.FullName)] } } This command runs perfectly, when running on the same server as the one where the .log files are stored (ServerA), however when running outside of it - no value is returned. Is there a way to

Run Powershell command from different server

霸气de小男生 提交于 2021-01-07 01:43:38
问题 I have the following powershell command that reads and gives me the status of my .bat scripts depending on the content of .log files : Get-ChildItem *.log | ForEach-Object { [pscustomobject] @{ Name = $_.Name Status = ('FAILED', 'SUCCESS')[(Select-String -Quiet 'Finished with NO errors' $_.FullName)] } } This command runs perfectly, when running on the same server as the one where the .log files are stored (ServerA), however when running outside of it - no value is returned. Is there a way to