Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
89 views

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
109 views

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
99 views

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
112 views

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
128 views

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
177 views

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
112 views

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
195 views

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
32 views

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

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,744
1 vote
0 answers
1k views

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
259 views

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
353 views

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

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

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
0 votes
1 answer
358 views

I'm trying to automate the process of setting up a multi-network DHCP. 172.16.0.13 is the network the Adatum domain is on. 172.16.18.21 is the network the relay agent is on. Both of these have the ...
Crazy Boy's user avatar
0 votes
1 answer
143 views

I have a working PS Script to run in an Azure Runbook to map a drive to a remote server to then copy very specific files to Azure blob storage. NOTE: The entire script works 100% in VSCode > ...
sllucas's user avatar
2 votes
0 answers
88 views

I am trying to install nuget package provider by using: Find-PackageProvider -Name NuGet -ForceBootsrap -IncludeDependencies in combination with Invoke-command -session $mysession But when running it ...
Alex's user avatar
  • 39
1 vote
0 answers
166 views

I've got a problem with running Invoke-Command on remote Computer with WinRM up and running. I've configured and run WinRM, but Invoke-Command with task of Silent Install is not successfully run until ...
anton123's user avatar
-1 votes
1 answer
76 views

I am executing the below Powershell script from a remote server. However it is failing as follows: PS C:\\Windows\\system32\> Invoke-Command -Session $evServerSession -scriptblock { \\>\> $...
Tchef's user avatar
  • 3
-1 votes
1 answer
452 views

$upgradeInvoke = Invoke-Command -Session $session -ScriptBlock { try { Shutdown.exe /r /f /t 1200 /d p:4:2 /c "Triggerd Reboot Timer for 20 minitus" $...
SpicerLabs's user avatar
0 votes
1 answer
291 views

I have been working on a script that can remove an old version of zabbix from our servers, and install the latest version. I am having a problem copying a file from a shared folder when I am using ...
bujom's user avatar
  • 61
0 votes
0 answers
602 views

I'm tying to get the permissions of all the folders in a path on a remote server as efficiently as I can so I want to make as few calls as I can (avoiding looping through all folders and running a get-...
Hyperbolic_Mess's user avatar
0 votes
1 answer
493 views

This code: $zonename = "mydomain.ca" $username = 'mydomain\svc_dns' $dnsserver = 'dns.mydomain.ca' $password = 'password' $securePassword = ConvertTo-SecureString $password -AsPlainText -...
J. Diefenbaker's user avatar
1 vote
1 answer
2k views

I open PowerShell as admin and use the following line of code to run an offline file for windows updates. It works fine Start-Process 'wusa.exe' -ArgumentList 'C:\Temp\windows10.0-kb5032189-...
Tevin Mosley's user avatar
0 votes
1 answer
402 views

I have multiple machines that need certificate padding enabled. My script looks like this: $ComputerName = Read-Host "Please Enter Computer Name" Invoke-Command -ComputerName $ComputerName -...
Ambre's user avatar
  • 35
2 votes
1 answer
398 views

I'm currently working with a script that utilizes the Invoke-Command over SSH as shown below. While it works well, I'm looking to implement exception handling, specifically for scenarios where the ...
Nanne's user avatar
  • 21
2 votes
1 answer
832 views

I'm trying to run a series of PowerSHell commands on my desktop computer that connect to one of the corporate servers and checks on the status of the services there. I'm doing a Run As on the ...
Ken's user avatar
  • 419
0 votes
0 answers
83 views

I've been tasked with updating some certificates on some remote servers. We have a TON of servers and not all of them have these certs installed. To make a short story long.... There are 2 different ...
Nate's user avatar
  • 75
1 vote
1 answer
233 views

In Windows Powershell (admin): Connect to Remote Windows $session = New-PSSession -ComputerName "xx.xx.xx.xx" Attempting Remote Execution Invoke-Command -Session $session -ScriptBlock { ...
WayneBello's user avatar
0 votes
1 answer
364 views

I have been racking my brain over this and scouring the internet for an answer, but I can't seem to find anything for my specific situation. I have created a set of Functions that help me add/remove ...
FlyingSubieSTi's user avatar
1 vote
2 answers
206 views

Executing practically the same command but remotely delivers no results in Powershell. This delivers empty lines: $certificates = Invoke-Command -ComputerName $computername -ScriptBlock { Get-...
brettkanker's user avatar
0 votes
1 answer
851 views

I am trying to figure out a way to use a global variable in a Invoke-Command without success. There are some posts which I tried but they do not work in this use-case. So what I have is a script like ...
k_k's user avatar
  • 83
1 vote
4 answers
859 views

I have written a script, that takes a csv file with vulnerable Servers and should replace the installed version of Notepad++. I uninstall the currently installed version from the machine, push a ...
poweruser181's user avatar
0 votes
1 answer
428 views

I need to be able to launch command by shell console or powershell having the administrator window in powershell 7. I have launched several commands with Start-Process but none of them returned the ...
alex's user avatar
  • 1
1 vote
1 answer
523 views

I have a table which is created using Time as the Column names. However if the first row does not have data in certain Hours(column) then the column does not show the column for the rest of the table....
Greg's user avatar
  • 13
0 votes
1 answer
76 views

I'm basically writing a program that takes an input of a current folder path from a user and a new folder path that they want to rename it as. Then the program remotes into a file server that the ...
Luke Willard's user avatar
0 votes
1 answer
116 views

I want to run [System.Net.Dns]::GetHostAddresses("mail") on remote computers and write it. Foreach($PCName in $PCNameArray) { $arrayJobs += Invoke-Command -Credential $cred -scriptblock {...
Ruslannnn's user avatar
0 votes
1 answer
148 views

I try to get Windows audit policies on several Windows servers with an Invoke-Command cmdlet. It works fine for all servers, except one where I get only the first object property (the added ...
scrouet's user avatar
1 vote
1 answer
1k views

[Could not find any relevant nor working answer, I checked the parameters, they are legit] I try to run an executable with its respective parameters, but with powershell here is the line: Invoke-...
pf12345678910's user avatar
0 votes
1 answer
62 views

I am trying to get a shadow storage information from remote computers. I could get the information and store in a variable as table. But every time the log file is being overwrite by the new ...
Brazs's user avatar
  • 77
0 votes
0 answers
306 views

when I execute: $serviceName = "Tanium Client" Get-Service $serviceName Directly On Server it gives: Status Name DisplayName Running Tanium Client Tanium Client but ...
Inderpal Singh's user avatar
3 votes
1 answer
233 views

Having a few issues with this PowerShell code: $vmslist = Import-Csv -Path .\vmsList.csv -Delimiter ',' | ForEach-Object { $_.Servers $vms = [string]$env:COMPUTERNAME $currentVms = $_....
dcwilli5's user avatar
0 votes
1 answer
1k views

I had a 'Bad Request' error while trying to use Get-AzConsumptionUsageDetail on my Powershell script to get consumption reports of multiple Azure subscriptions, I looked on the internet and it seems ...
Mantra Reborn's user avatar
0 votes
1 answer
297 views

I try to run an oracle bat script (opatch.bat) remotely to gather info on patchlevels on oracle agent installations. The command to run is invoke-command -ComputerName <remote_computer> -...
Mats Nordqvist's user avatar
0 votes
1 answer
818 views

I have wrote that script but the result is the same for all the computer.To be more precise if my device has the registry Name then all have it which does not reflect the reality.Same if my device ...
fab's user avatar
  • 3
0 votes
2 answers
636 views

The goal of the script is to invite a user to a specific project in Azure DevOps via REST. Invoke Request was used to add a user with the appropriate permissions. I'm able to successfully retrieve the ...
Shez Bhagwandin's user avatar
0 votes
0 answers
547 views

I'm trying to make a powershell script to uninstall Onedrive from users computers by running Invoke-Command -computername computer1 -filepath script.ps1 but i keep getting issues with the last step. ...
Adde's user avatar
  • 1
1 vote
1 answer
5k views

Script_A.ps1 on Server A: Invoke-Command -ComputerName Server B -ScriptBlock{ Set-Location "C:\Path" .\Script_B.ps1 } The Script "Script_B.ps1": Set-Location "C:\...
cosmo_'s user avatar
  • 11
0 votes
0 answers
58 views

The py -3 -m venv venv command works when typed manually into a Powershell terminal, but breaks when called from a ps1 script. What specifically must be changed in the code below in order for the ...
CodeMed's user avatar
  • 9,251

1
2 3 4 5
12