Skip to main content

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

Parameter values empty in Powershell function

All my parameter values are being received as empty in this seemingly straightforward function: function Get-SSH-Command { param ( [string]$private_key_path, [string]$user, ...
Michael Currie's user avatar
0 votes
0 answers
12 views

How does PowerShell simulate mouse clicks? I used the following code but got an error

I used the following code but got an error Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class MouseHelper { [DllImport("user32.dll")] ...
ONNN's user avatar
  • 1
0 votes
0 answers
18 views

Adding permissions with Set-Acl in Powershell removes all inherited permissions on shares

When I try to add a permission using Set-Acl on a share where the share itself has inherited permissions, all inherited permissions are removed. Consider the following setup: Physical Path ...
Tanaka Saito's user avatar
  • 1,048
0 votes
0 answers
15 views

Bitlocker Recovery Key to AzureAD [closed]

So i am looking for any solution to assist with backing up Bitlocker recovery keys to Azure AD History: We had MBAM which was not storing keys in AD for some of our USB drives, we have opted to move ...
Avren Paul's user avatar
0 votes
0 answers
15 views

PowerShell ANSI escape sequences crash the shell if sequence string is too long

Can anyone shed any light on why executing the first statement does what's expected and returns to the prompt but the second one, while completing what's expected, crashes PowerShell 5 and 7 a few ...
Ruutsa's user avatar
  • 189
2 votes
1 answer
31 views

Is it possible to reference a psObject/Hashtable name via a variable? [duplicate]

Lets say I have a serious of objects (in pscustomObject or Hashtables) and I need to reference them dynamically, as is it the user that is deciding what data to access. .... $sweden = [PSCustomObject]@...
Ralf_Reddings's user avatar
0 votes
0 answers
8 views

Sharepoint Online Issue: Manual vs Programmatic File Upload

I am trying to embed an aspx file in a Sharepoint page (with the file stored in SiteAssets), but have discovered that Sharepoint behaves differently based on how I upload the file. If I upload it ...
KenG's user avatar
  • 1
0 votes
0 answers
22 views

How to pass password in Powershell or Powershell ISE script

DISCLAIMER: I don't know squat about scripting. I need to access our Cyerbark vault via API. Our Cyerbark group gave me a Powershell ISE script to run. The script calls an SSL cert that requires a ...
Craig 's user avatar
2 votes
0 answers
31 views

How does a string unexpectedly become an array?

In one of my script I have the following problem: assigning to a string variable the result of a function makes the string an array. Example: $x="" function findX{parm([string]prmx) ... some ...
LuigiV TH's user avatar
0 votes
0 answers
27 views

Powershell following rotation of log file

I know that is not a good idea runs a script for ever but, I need to continuously tail a log file, for some days, to get the evidence of some errors. Problem is that this log file rotates multiple ...
ilRobby's user avatar
  • 81
0 votes
1 answer
24 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 ...
Royston's user avatar
  • 15
1 vote
3 answers
59 views

Enumerate Rest API result returned as nested PSCustomObjects

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 ...
rga.cz's user avatar
  • 73
0 votes
1 answer
47 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 ...
gucisz's user avatar
  • 29
0 votes
1 answer
28 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 ($_....
Kourosh's user avatar
1 vote
1 answer
21 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; $...
snehasish nandy's user avatar

15 30 50 per page
1
2 3 4 5
7865