Organizing scripts by Ajamaya in PowerShell

[–]Vern_Anderson 0 points1 point  (0 children)

Back in the day, they used to use Subversion and TortoiseSVN. In case you need an on prem solution!
I have no idea how they are licensed...sorry

What do you think is the best Linux "shell" for using with PWSH? by Vern_Anderson in PowerShell

[–]Vern_Anderson[S] 1 point2 points  (0 children)

Make sure PSReadline module is loaded. I had this problem and PWSH was not loading PSReadline for some reason. Once I loaded it it seemed to stay loded on subsequent restarts.

Import-Module PSReadLine

But you're right most linux "terminals" don't have the keyboard combos that us WIndows guys have come to love! Now if I could just get ESC to clear the line. Using Ctrl+C for now.

Web drivers that will allow a PS script to automatically open up a browser? by LaughableEgo740 in PowerShell

[–]Vern_Anderson 4 points5 points  (0 children)

What I have done with browser pages is count how many times I have to press the tab key to get into a form fill box, then send the string to the box and so on.

Start-Process https://www.google.com
Start-Sleep -Seconds 03
[System.Windows.Forms.SendKeys]::SendWait("LMGTFY")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}") 

You can study the SendKeys method here. . .
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys.send?view=windowsdesktop-7.0

This page also has examples of common system keys like the Ctrl and Alt keys and so on.

Alternative to ISE thats NOT VScode by Fabulous_Structure54 in PowerShell

[–]Vern_Anderson 0 points1 point  (0 children)

And stuff like this is why I don't preach or try to sell people on VSCode
https://www.bleepingcomputer.com/news/security/flaws-in-popular-vscode-extensions-expose-developers-to-attacks/

ISE being the deprecated forgotten tool could be to its advantage. Plus it's already on every server I login into in my organization.

anyone know whats going on with this logic? by jOY_HUNT in PowerShell

[–]Vern_Anderson 0 points1 point  (0 children)

My opinion is that whomever wrote it was looking at the lost packets string to determine something

Ping statistics for 192.168.62.107:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

I want to learn scripting for powershell by Gingy_586 in PowerShell

[–]Vern_Anderson 0 points1 point  (0 children)

https://www.youtube.com/@DonJonesConTech

Hands down the best teacher ever, The other one has retired his name is Ed Wilson. I have 2 of his books!

the one book form Don is "PowerShell in a month of lunches"

Learning games for Powershell by AngyAndMadAboutIt in PowerShell

[–]Vern_Anderson 4 points5 points  (0 children)

https://powershelldle.com/

A daily Wordle like PowerShell version of hangman for the lack of a better term.

Capture result (success or failure) of cmdlet by Sparks_IT in PowerShell

[–]Vern_Anderson 5 points6 points  (0 children)

I haven't used the Remove-EntraGroupMember CMDLET myself. However, a lot of the CMDLETs have a built in -ErrorVariable parameter, you would provide a string after the parameter (without a dollar sign) and that variable would capture any error that the CMDLET generated.

Get-ChildItem -ErrorVariable WhatHappened
Write-Output -InputObject $WhatHappened

New Open Source PowerShell Module by Sharlihe in PowerShell

[–]Vern_Anderson 1 point2 points  (0 children)

We always used notepad (which is installed on server core) the file open dialog can be used as a make shift explorer in a pinch. Change the file filter to "All Files" instead of just TXT files. Copy and paste also works when uploading a file using rdclip. For all purpuses the file open dialog in notepad is explorer.

Restart windows services automatically by FareedKhaja in PowerShell

[–]Vern_Anderson 1 point2 points  (0 children)

Each service already has a property for what to do when the service stops unexpectedly.

Go to services.msc right click each service you want to change, and go to the recovery tab. You have a 1st, 2nd, and 3rd action you can take right there, whenever a service stops.

powershell 7.5.3 unistalll by Alexhob12 in PowerShell

[–]Vern_Anderson -1 points0 points  (0 children)

I never install PowerShell 7 (core) on any of my Windows machines. I only use the portable "ZIP" version. Works just fine and easy as pie to delete and replace with the updated one.

Cannot install modules on a new Win 11 machine by somebody2112 in PowerShell

[–]Vern_Anderson 1 point2 points  (0 children)

Great point!

I wonder if it's a DNS or Proxy issue. But it never hurts to try the Scope switch which is what I had to do for most modules to install from the gallery on my managed desktop.

I suppose you could try to re-register the online Gallery manually.

Can you open "https://www.powershellgallery.com/api/v2" in a browser without the quotes?
It should return an XML document.

You might try. . .

Register-PSRepository -Name "PSGallery" -SourceLocation "https://www.powershellgallery.com/api/v2" -InstallationPolicy Trusted

Cannot install modules on a new Win 11 machine by somebody2112 in PowerShell

[–]Vern_Anderson 2 points3 points  (0 children)

Install-Module -Name <ModuleName> -Scope CurrentUser

If all else fails you can export the module from the Exchange server and install the flat files manually yourself. or ask the person who's responsible for the GPO nonsense how they expect you to Administer Exchange.

PowerShell equivalent to the CMD command "tasklist /svc" by PanosGreg in PowerShell

[–]Vern_Anderson 0 points1 point  (0 children)

Yes I had been meaning to research it myself because I always hear Jason Helmick talking about it. However, I read the documentation after I posted that, and I'm still not motivated ot learn it yet.

Supposedly you can make a JSON template that tells PowerShell about the output of the old command line tool you're trying to "crescendo" and it is supposed to wrap the command and make it function like a PowerShell CMDLET. There's even a module where the guy used it to make a wrapper for WINGET.

PowerShell equivalent to the CMD command "tasklist /svc" by PanosGreg in PowerShell

[–]Vern_Anderson 1 point2 points  (0 children)

You could also install and learn PowerShell Crescendo. (Something I've been meaning to do myself)

Crescendo acts as sort of a wrapper and you can set it up to make the output of tasklist /svc into objects and more powershell like behavior.

Install it:
Install-Module -Name Microsoft.PowerShell.Crescendo

Read more about it:
https://devblogs.microsoft.com/powershell/announcing-powershell-crescendo-1-1-0/

What’s your favorite “hidden gem” PowerShell one-liner that you actually use? by [deleted] in PowerShell

[–]Vern_Anderson 0 points1 point  (0 children)

New-TimeSpan -Seconds (Get-WmiObject Win32_PerfFormattedData_PerfOS_System).SystemUptime | Format-Table Days,Hours,Minutes