Questions tagged [powershell]
PowerShell is a cross-platform command line and scripting utility from Microsoft. Use this tag for questions about writing and executing PowerShell scripts ONLY. Programming questions specific to the cross-platform version PowerShell Core (Windows, macOS, and Linux) should be tagged [powershell-core]. Questions about system administration should be asked on Super User or Server Fault.
powershell
117,963
questions
0
votes
1
answer
17
views
Powershell : Root directory is not included in the ZipFile
function Compress-CompatibleArchive {
$contents = Get-Content -Path C:\Users\USER\OneDrive\Documents\WindowsPowerShell\modules\Parameters.txt | Out-Null
#Split the line into parameter name and ...
0
votes
3
answers
35
views
Enumerate Rest API result
By rest API call using Invoke-RestMethod I get a result value.
These are members of this variable:
TypeName: System.Management.Automation.PSCustomObject
Name MemberType ...
0
votes
1
answer
40
views
Powershell - iterate through CSV file
i'm sruggeling with some script that checks NW connectivity between hosts basicaly i have CSV with source IP and port which looks like this
the problem is when i run this script it checks me every ip ...
0
votes
1
answer
24
views
PowerShell script output issue and AD
Get-CimInstance -ClassName SoftwareLicensingProduct -computerName test,test2,test3,test |
where PartialProductKey | select Pscomputername,Name,@{Name='LicenseStatus';Exp={
switch ($_....
0
votes
0
answers
15
views
Issue while populating data in excel sheet using powershell
I am having below code in powershell which I am using to populate the data in excel
# Apply the formula in column O for all rows
$lastRowO = $sheet1.UsedRange.Rows.Count
for ($rowO = 2; $...
-2
votes
0
answers
20
views
compare the difference between executing commands directly in CMD and running them through C#
I am currently developing a remote program using SSH. While it connects well when accessing a Windows 10 system, it fails to connect when accessing a Windows 11 system. I would like to ask how to ...
0
votes
0
answers
17
views
Powershell error when working with credential manager
I have written a PowerShell script for WinSCP and use a saved credential in the Credential Manager. To save this in the Credential Manager, I have executed the following in the Powershell ISE.
$...
0
votes
0
answers
27
views
Proxy error: Unable to parse auth header from HTTP proxy: authentication type 'NTLM' not supported"
I am using a batch script to download files from an SFTP server over the Internet. The script is running on a VM which is behind a corporate proxy.
When I am logged in to the SFTP server via WinSCP, ...
0
votes
0
answers
11
views
Can I inherit custom loaded functions or cmdlets in Powershell after running Enter-PSHostProcess?
In Powershell, I can use Enter-PSHostProcess to debug specific programs. Since I'm doing a lot of debugging I thought I'd write a function to save me some time. The function:
function global:Debug-...
-1
votes
0
answers
16
views
How can i delete an excel file after writing some data to it in Powershell?
I write some data to an excel file and when I run my code again I want to delete the file and create the file again
Issue is that it says PowerShell is locking the file .
<I get the $email object ...
1
vote
1
answer
27
views
Powershell ExpandProperty changes source object - why?
Lets say I have an array of objects with some properties, one of which is itself an array of objects. I want to 'flatten' this structure & report each of the embedded objects alongside selected ...
0
votes
1
answer
19
views
Powershell text search won't find strings with spaces
I have aproblem with this Powershell snippet. The problem is that when @search_string is one single string, it finds it in the file, BUT when @search_string contains as space, it doesn't find it. e.g....
0
votes
0
answers
12
views
Create a code to create a multiple virtual machines and run a script in powershell?
I have a difficulty in creating a code to create a multiple VMs in windows server. I should run a script in powershell to create VMs.
A suggested code for the multiple VMs and a script to run in ...
0
votes
0
answers
16
views
How can i get the content(text) of a Microsoft.Graph.PowerShell.Models.MicrosoftGraphItemBody in Powershell?
At the moment i get the email data as follows:
$messages = Get-MgUserMailFolderMessage -UserId $mailboxUserId -MailFolderId $folderName
$messages.Subject;
$messages.Body
$messages.Content;
But ...
0
votes
0
answers
24
views
How to build a dashboard with device status returned from API
First I am new to developing stuff.. I have some Azure Power Platform experience only, Function App, Storage accounts, Flows, PowerApps PowerBI, etc..
and can write most just PowerShell code..
We have ...