Powershell 5.1 unable to install-module or update NuGet any longer due to TLS 1.3....
Reddit » PowerShell
by /u/evolutionxtinct
2h ago
So this is odd, I can't seem on Server 2016/2019 to run install-module any longer, it says NuGet needs to be installed, and when I try to update NuGet I get errors, everything i've tried doesn't seem to fix it. I install Powershell 7.0 which has tls13 available, and bam everything works! I try it on Windows 11 (as Windows 10 didn't work) and it worked in Powershell 5.1 but this version has tls13 available.... How can I fix this on all my servers without installing PowerShell 7.0 or is this my only option? Thanks! submitted by /u/evolutionxtinct [visit reddit] [comments ..read more
Visit website
Custom PlatyPS module supporting PowerShell 7.4
Reddit » PowerShell
by /u/joshooaj
2h ago
I wanted to have a version of PlatyPS I could use with PowerShell 7.4 where the new ProgressAction common parameter was properly identified as a common parameter, and the .NET target was compatible with the version of YamlDotNet used in the powershell-yaml module. Initially I modified PlatyPS as needed, and embedded my custom version in my repo’s, importing the module from the repo instead of installing from the gallery. But I didn’t like doing it that way, and I wanted a simple way to run PlatyPS in a GitHub Action where the runners all use PowerShell 7.4. This is only a short-term solution ..read more
Visit website
Someone explain this.
Reddit » PowerShell
by /u/smarsha
2h ago
Why does this code change the $DriveMaps ArrayList to an object when added to an empty array? $outXML = @() $DriveMaps = New-Object System.Collections.ArrayList $objDrv = @( [PSCustomObject]@{ Location = 'NEW' DriveLetter = 'A' NetworkPath = '\\Server\Share1' DriveName = 'Team4' ADGroup = 'Team4' } ) $DriveMaps.Add($objDrv) | Out-Null $objDrv = @( [PSCustomObject]@{ Location = 'NEW' DriveLetter = 'B' NetworkPath = '\\Server\Share2' DriveName = 'Team5' ADGroup = 'Team5' } ) $DriveMaps.Add($objDrv) | Out-Null $DriveMaps.GetType() $objEntry = [PSCustomObject]@{ Location = 'New' DriveMaps = $Dri ..read more
Visit website
Struggling with connecting powershell to CSV file for sql query
Reddit » PowerShell
by /u/Entire-Reference823
2h ago
Hi all, I’m new to PowerShell and I am struggling with passing through connection strings and sql statement. In essence what I would want it to do is to get PowerShell to connect to the CSV file, run the SQL statement and paste the result in a specified location in an excel file. Unfortunately due to the CSV size it takes a long time to get excel to pull the data via powerquery or vba sql. Any help would be greatly appreciated submitted by /u/Entire-Reference823 [visit reddit] [comments ..read more
Visit website
Using invoke-webrequest to parse links from a Javascript collapable table thing
Reddit » PowerShell
by /u/GingerSnapBiscuit
9h ago
So I'm trying to use invoke-webrequest to parse a set of links from a website I'm trying to scrape, I use the following : (Invoke-WebRequest -Uri $Link).links.href; This gives me a list of raw URLs from the website, however the particular URLs I'm interested in are in a Javascript table thingy with a collapsable header, when this particular part is parsed all I see in the output is : javascript:void(0) I assume I'm just screwed here? There is no way to expand this collapser and read the URLs within? submitted by /u/GingerSnapBiscuit [visit reddit] [comments ..read more
Visit website
Getting Send-MailMessage to timeout. Cannot figure it out!
Reddit » PowerShell
by /u/Bballjoe12
9h ago
I'm trying to figure out if there is someway I can make Send-MailMessage timeout after a certain period of time? It seems like it takes over 2 minutes to timeout if it can't send the message. I've tried using a job, a while loop and a timer but the Send-MailMessage seems to stop everything else and will continue running until it times out. The reason I am wanting it to time out after a certain amount of time is if the SMTP server is not working correctly. Any ideas? submitted by /u/Bballjoe12 [visit reddit] [comments ..read more
Visit website
Get-MgGroup returns 403 but running https://graph.microsoft.com/v1.0/groups with the same account in Graph Explorer works
Reddit » PowerShell
by /u/brimur
9h ago
I feel like I am constantly fighting Graph. Using the deprecated AzureAD module or the Az module I can run Get-AzureADGRoup or even Get-AzGroup and it works with my account and when I login to Graph Explorer and run https://graph.microsoft.com/v1.0/groups or look for a group I get the response I expect but when I run Connect-MgGraph with the same account and run Get-MgGroup I get 403 Access Forbidden. My user in Azure has the User Administrator role. When I look at assigned permissions I see this... Microsoft Graph Group.ReadWrite.All Read and write all groups Delegated When I check my sco ..read more
Visit website
In VS Code Is there a way that I can auto write all members of a class?
Reddit » PowerShell
by /u/guy1195
9h ago
This is just a silly example, but doing the below would take an age to write out each one, and I have to do this quite a lot. Has anyone found a way that I can just write "$myPerson." and press a hotkey or something to automatically write out every member? class Person { [string]$FirstName [string]$LastName [string]$Address [string]$City [string]$State [string]$ZipCode [string]$PhoneNumber [string]$EmailAddress [string]$DateOfBirth [string]$Gender [string]$Occupation [string]$Company [int]$Age } $myPerson = New-Object Person $myPerson.FirstName = "FirstName" $myPerson... Cheers! submitted ..read more
Visit website
Am I missing something painfully obvious?
Reddit » PowerShell
by /u/ImpostureTechAdmin
9h ago
$csv = Import-Csv "$env:USERPROFILE\Downloads\fdte.csv" $agent = $csv.Agent $count = 0 foreach ($i in $agent){ if ($i -like "knownexample"){ $count = $count + 1 } else{ write-host $i } } Everything in $i gets printed to stdout via the else condition, and I can't get any registration for a partial match by using either -like or -contains. For giggles I replaced $count = $count + 1 with write-host Hi and it doesn't greet me a single time >:( I'm probably going to convert this to use a switch operator but, for my own knowledge and hopefully a contribution to the internet archives, wh ..read more
Visit website
Get logged in profile for file path to delete cached files
Reddit » PowerShell
by /u/Main-Ad-7656
9h ago
Hi all I am a complete beginner on power shell with a task to delete office file cache on many users devices. Ideally what I am trying to create is a script that will do this for me that can be implemented onto users devices for them to run as and when it is needed. What I am struggling with is creating the path to the file using the logged in user name. I am creating the environment as username and then anything after this I am not understanding. Any help will be hugely appreciated!! Thank you! submitted by /u/Main-Ad-7656 [visit reddit] [comments ..read more
Visit website

Follow Reddit » PowerShell on FeedSpot

Continue with Google
Continue with Apple
OR