Questions tagged [powershell-5.1]
280 questions
0
votes
1 answer
Powershell Select property with a variable as
The following script searches deletes statements in SSIS. These delete statements came from sql cache for some reason they came back with "]" missing. This missing brace is causing my select object to fail see error below. I cant remove braces…

Leo Torres
- 673
- 1
- 6
- 18
0
votes
1 answer
powershell increase threshold in parallel
How do I increase threshold in parallel.
I've done some research where it uses these syntax for increase but unsure how to implement in my code.
ForEach-Object -throttleLimit 5 -parallel
My code:
foreach ($User in Import-Csv -Delimiter ","…

Glen Sale
- 43
- 2
- 8
0
votes
1 answer
is there any limit in key and value for hashtables in powershell 5.1?
I am using PowerShell 5.1 and adding the key, value content in hashtables. but I see, it is not adding the complete content in value when the value is too large around 6000 characters. So, my question is: Is there any limit while we use PowerShell…

Ashish Goyanka
- 207
- 3
- 11
0
votes
1 answer
Accessing properties or turning hashtable into object
So basically I'm trying to return a list of accounts that doesn't match the ones in my whitelist.
And I'm doing so this way.
$UserList = Get-ADUser -Filter * -Server $domain | select -Property Name, samAccountName
$checkUsers = $UserList |…

Archangel
- 13
- 3
0
votes
1 answer
Insert data with a collection object into a SQL Server table
The code below does not error, it inserts into a SQL Server table with no issues. However the [ServicePrincipalNames] data is not inserted how I planned.
The value that gets inserted into the table…

Leo Torres
- 673
- 1
- 6
- 18
0
votes
1 answer
Windows Server 2012R2/2016: HOWTO Check for the Active Directory PowerShell Module using Get-WindowsFeature
Windows Server 2012R2/2016: HOWTO Check for the Active Directory PowerShell Module using Get-WindowsFeature
I need a means to ensure the Windows 2012R2/2016 server I run an AD script on has Imported Active-Directory, and install it if not
#Check if…

Patrick Burwell
- 129
- 1
- 12
0
votes
1 answer
Does a DynamicParameter Switch not read like a Static Parameter [switch]?
Hopefully the Title is clear enough but, I am having some trouble understanding on how to evaluate against a DynamicParameter Switch, compared to a Static (type casted) switch.
In the following code block, there are 2 switches that become available…

Abraham Zinala
- 4,267
- 3
- 9
- 24
0
votes
1 answer
PowerShell Get-ADUser with ANR
I'm trying to search Active Directory for a user with the following statement, but I get an error when I use $("smtp:$user").
get-aduser -filter {(anr -eq $user) -or (anr -eq $("smtp:$user"))}
Could anyone explain why please, or is there a better…

Bill Addison
- 43
- 4
0
votes
0 answers
PowerShell 5.1 & PowerShell 7 same script, different outcomes
I am trying to run this script:
$dll = Add-Type -Path \\machineX\Folder\\AL.Scripting.dll
New-Object AL.Scripting.BsmScriptObject
When running on PS 5.1 everything runs fine, but when ran on PW 7 I get:
System.AggregateException: One or more errors…

Edvardas Alaburda
- 31
- 1
- 4
0
votes
1 answer
How to run `Get-CimInstance` as non-admin user (windows server 2019, powershell 5.1)
I am trying to run a powershell command on a server very similar to this one.
https://stackoverflow.com/a/55942155/4577279
The problem is that the script is being run by a non-admin user, and it fails to run the
Get-CimInstance command.
it fails…

Kevin Leutzinger
- 21
- 3
0
votes
1 answer
Powershell modify CSV
I read a lot of questions here about this and i don't find what i search ...
I start scripting with powershell (just for information :p )
I want to modify a CSV file, exported from a database with information like…

Livarkhal
- 15
- 3
0
votes
0 answers
powershell showing different behavior on same shell
When I run following command on powershell window (version 5.1)
(Get-Service *someServiceName*).status
I get output in 3 columns as follows:
PSComputerName RunspaceId Value
-------------- ---------- -----
xxxxx xxxxxx Running
On the…

Vishwanath
- 149
- 2
- 14
0
votes
1 answer
Powershell - Getting distinct values from a collection of hash tables
I'm using powershell version 5.1 for everything. The background of my issue is I'm using powershell DSC to create webapplications and app pools for various nodes. For every server except the last 2, every web application has a unique app pool so…

Nicholas McQuillen
- 88
- 9
0
votes
0 answers
function with mandatory and optional parameters
Below is my code to configure required services wherein I see error as Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were…

NKRSHNA
- 15
- 8
0
votes
1 answer
PowerShell how to present function parameters in the form of CSV
I'm new to PowerShell and I have very simple task: to output three function parameters as CSV string. Here what I get:
function ToCsv($v1, $v2, $v3) {
Write-Host $v1, $v2, $v3
Write-Host "$v1,$v2,$v3"
Write-Host $v1 + "," + $v2 + "," +…

Mark Tsizis
- 266
- 1
- 5
- 8