Skip to main content
2 votes
1 answer
76 views

Invoke-Command remote script behaviour on Server 2016 vs 2025

I have an existing script which has worked for some time running on a Windows Server 2016 server, but which gives me an error when run on its relacement 2025 server. What is strange is the error doesn'...
Keith Langmead's user avatar
1 vote
1 answer
105 views

In PowerShell, I cannot transfer System.Data.DataTable using the invoke-command to the remote host

Here is a script in which I am trying to pass a variable of type System.Data.DataTable via invoke-command to the remote host: function Test1 { param ( [System.Data.DataTable] $...
Vladimir1211's user avatar
1 vote
2 answers
90 views

Invoke-Command and/or Start-Process fail if no user session is active on the remote system

tl;dr If I locally start Invoke-Command to start an EXE file remotely, it fails, if there is no active user session on the remote system. I am facing the challenge of installing an application with ...
LukasHT's user avatar
  • 345
1 vote
2 answers
108 views

Powershell Invoke-command works but returning an exception

My script opens a WebDAV session to my server, but on some occasions the command is stuck, without any exception. The command is $Session.Open($SessionOptions). To monitor the command with a timeout, ...
POL's user avatar
  • 65
1 vote
1 answer
125 views

PowerShell: executing C# Class (FindFiles) as an Add-Type definition on a remote system using Invoke-Command is extremely slow

I want to find all Package.json files on a remote system using PowerShell. In order to optimize this, I found a C# class on the internet adjusted it and now would like to use it. This code runs really ...
AhYep's user avatar
  • 11
0 votes
3 answers
173 views

Issue "Invoke-Command & Get-Content with large files"

this is my first post because i can't find a solution and i don't understand whats wrong... I have a simple script which should read a large logfile on a client with get-content in an invoke-command. $...
Presl's user avatar
  • 1
0 votes
1 answer
105 views

Powershell invoke-command: why isn't this engaging the foreach loop? [duplicate]

OK, I'm piggybacking off my previous question Powershell script to get IIS app pool recycling time from servers and wondering what I'm doing wrong I have a list of IIS app pools (apppools.txt) and a ...
dbutts's user avatar
  • 43
0 votes
1 answer
186 views

Use Invoke-Command create new user with secure password on remote client

I am struggling to resolve what should be a simple thing. I am looping through a list of computers $bcs for each $bc in $bcs. I run the command below to remotely create the user account with the ...
LED4's user avatar
  • 3
1 vote
0 answers
31 views

Error using Powershell's Invoke-Command with Filepath [duplicate]

I have a Powershell script 'hello-world.ps1', which is overly simple, it takes no arguments and simply writes some text to the console: Write-Host "Hello world" With the command prompt, ...
SimonAx's user avatar
  • 1,388
2 votes
2 answers
81 views

Why do I get access denied using Invoke-Command on localhost?

I have valid credentials of a Windows service account stored in $creds and want to use them to access the C:\temp\ directory on another server called remotehost. I use Invoke-Command to execute the ...
dokaspar's user avatar
  • 8,704
1 vote
0 answers
1k views

Executing sfc.exe /scannow on Remote Computer Using PowerShell Doesn't Show Process

I'm attempting to run sfc.exe /scannow on a remote computer using PowerShell's Start-Process, but I'm unable to confirm whether the process starts on the remote machine. When I check for any sfc ...
user2978216's user avatar
-1 votes
1 answer
255 views

Understanding PowerShell SessionOption OperationTimeout Behavior with Invoke-Command

I've set the OperationTimeout to 10 seconds, but when I run a command that sleeps for 20 seconds inside an Invoke-Command block on a remote computer, I don't get an error. Here's the code: $...
user2978216's user avatar
0 votes
1 answer
344 views

Efficiently Retrieving Microsoft Edge Versions from Multiple Remote Machines Using PowerShell Jobs

$command = { try { $package = Get-Package -Name "*Microsoft Edge*" return [PSCustomObject]@{Version = $package.Version} } catch { return &...
user2978216's user avatar
0 votes
2 answers
360 views

How to get return value of Invoke-Expression in Powershell

So this is my code $result = Invoke-Command -Session $session -FilePath $ps1 How do I get the result given by $ps1? The code of that function is supposed to give a true false result like in the ...
Anne Marie's user avatar
1 vote
1 answer
2k views

When using invoke-command with credentials, credential parameter not properly initialized

So I tried calling the following code with and without credentials. $username = "user" $password = "password" $cred = new-object -argumentlist $username, $password #Invoke-Command ...
Anne Marie's user avatar

15 30 50 per page
1
2 3 4 5
39