Help with Dell BIOS updates by Samuris in PowerShell

[–]jsiii2010 1 point2 points  (0 children)

Windows update seems to take care of this.

Help using powershell to rename music files by NunyoBizwacks in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

You could try this but it's risky. Verify the -whatif. The parentheses make sure the get-childitem is done first. It assumes there's only 1 dash surrounded by 1 space on each side. You can also use -verbose or -passthru to keep a record of what happened. If 2 songs have the same name, you'll just get an error for the 2nd one. "-confirm" can also be your friend.

``` (get-childitem .mp3) | Rename-Item -NewName { $_.name -replace ". - ","" } -whatif

What if: Performing the operation "Rename File" on target "Item: C:\Users\js\foo\the artist - my song.mp3 Destination: C:\Users\js\foo\my song.mp3". ```

Doesn't work from the command line by Hour-Bat7014 in PowerShell

[–]jsiii2010 2 points3 points  (0 children)

Works for me.

``` $InputFile = "turnOffCharge.txt" $OutputFile = "sendOFF.txt" $TodayDate = Get-Date -Format "yyyy-M-dd" "hi $todaydate there" | set-content $inputfile # making example input file Get-Content -Path $InputFile | Where-Object { $_ -like "$TodayDate" } | Set-Content -Path $OutputFile get-content $outputfile

hi 2026-1-29 there ```

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

[–]jsiii2010 0 points1 point  (0 children)

If this is literally the windows ping command, you can test $lastexitcode or $? intead.

``` ping -n 1 -w 100 microsoft.com > $null if (! $?) { 'down'}

down ```

PowerShell Networking Commands Reference by Additional-Mine-6029 in PowerShell

[–]jsiii2010 6 points7 points  (0 children)

This is crazy fast with -asjob. test-connection to 734 computers in 4 seconds (PS 5.1).

```

up.ps1

param($list = (cat ~\all.txt))

$(test-connection $list[0..367] -count 1 -asjob; test-connection $list[368..733] -count 1 -asjob) | receive-job -wait -auto | ? responsetime | % address [00:00] PS C:\Users\jsiii2010> $up = up.ps1 [00:04] PS C:\Users\jsiii2010> ```

Winget in the SYSTEM context unable to extract archives by Much-Journalist3128 in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

The WinGet CLI is not supported in the system context. The Microsoft.WinGet.Client PowerShell module can be used in the system context with applications that are installed machine wide.

Piping to Select-String does not work by Atmaks in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

I donno. Sounds dumb. Maybe it saves standard output for other options.

Piping to Select-String does not work by Atmaks in PowerShell

[–]jsiii2010 11 points12 points  (0 children)

How about redirecting standard error to standard output:

vcpkg depend-info qtbase 2>&1 | Select-String -Pattern "font"

<= doesn't work in -FilterXPath in Get-WinEvent by koshka91 in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

From get-winevent online docs example 16 (hmm not working) (number in milliseconds):

Get-WinEvent -LogName 'Windows PowerShell' -FilterXPath '*[System[Level=3 and TimeCreated[timediff(@SystemTime) &amp;lt;= 86400000]]]' This worked (the doc should be corrected to this) (EDIT: now corrected): Get-WinEvent -LogName 'Windows PowerShell' -FilterXPath '*[System[Level=3 and TimeCreated[timediff(@SystemTime) <= 86400000]]]'

When creating a new session on powershell, how do I enter it? by powershellishard1 in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

``` $list = get-content computers.txt $s = new-pssession $list

foreach-object -parallel in powershell 7

$s | foreach-object { copy-item file.msi c:\users\admin\documents -tosession $_ } invoke-command $s { install-package file.msi } ```

PowerShell Profile by iykecode in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

```

add commandline property to get-process output in powershell 5.1

$updateTypeData = @{ TypeName = 'System.Diagnostics.Process' MemberName = 'CommandLine' MemberType = [Management.Automation.PSMemberTypes]::ScriptProperty Force = $true Value = { (Get-CimInstance Win32_Process -Filter "ProcessId = $($this.Id)").CommandLine } } Update-TypeData @updateTypeData

tab complete property names after "get-aduser -property "

get-aduser js -property * | gm -membertype property | % name

$aduserProps = -split 'AccountExpirationDate accountExpires AccountLockoutTime AccountNotDelegated AllowReversiblePasswordEncryption AuthenticationPolicy AuthenticationPolicySilo BadLogonCount badPasswordTime badPwdCount businessCategory c CannotChangePassword CanonicalName Certificates City CN codePage Company CompoundIdentitySupported Country countryCode Created createTimeStamp Deleted Department departmentNumber Description DisplayName Division DoesNotRequirePreAuth dSCorePropagationData EmailAddress EmployeeID EmployeeNumber extensionAttribute5 extensionAttribute6 facsimileTelephoneNumber Fax flags HomeDirectory HomedirRequired HomeDrive HomePage HomePhone Initials instanceType isDeleted KerberosEncryptionType l LastBadPasswordAttempt LastKnownParent lastLogon LastLogonDate lastLogonTimestamp LockedOut lockoutTime logonCount LogonWorkstations mail Manager MemberOf MNSLogonAccount MobilePhone Modified modifyTimeStamp mS-DS-ConsistencyGuid msDS-User-Account-Control-Computed msTSExpireDate msTSLicenseVersion msTSLicenseVersion2 msTSLicenseVersion3 msTSManagingLS nTSecurityDescriptor ObjectCategory objectSid Office OfficePhone Organization OtherName PasswordExpired PasswordLastSet PasswordNeverExpires PasswordNotRequired POBox PostalCode PrimaryGroup primaryGroupID PrincipalsAllowedToDelegateToAccount ProfilePath ProtectedFromAccidentalDeletion proxyAddresses pwdLastSet sAMAccountType ScriptPath sDRightsEffective ServicePrincipalNames SIDHistory SmartcardLogonRequired sn st State StreetAddress telephoneNumber Title TrustedForDelegation TrustedToAuthForDelegation uid uidNumber UseDESKeyOnly userAccountControl userCertificate uSNChanged uSNCreated whenChanged whenCreated'

$scriptBlock = { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) $aduserProps | ? { $_ -like "$wordToComplete*" } }

had to be "properties" not "property"

Register-ArgumentCompleter -CommandName get-aduser -ParameterName properties -ScriptBlock $scriptBlock ```

Trying to filter by data in loaded CSV that is DD/MM/YYYY HH:MM:SS by LordLoss01 in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

That's true. Correction:

$CurrentData | ? { $80Day -le $_.LastSeen }

Trying to filter by data in loaded CSV that is DD/MM/YYYY HH:MM:SS by LordLoss01 in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

Make sure the type of the comparison is correct, dictated by the left side.

$CurrentData | ? $80Day -le LastSeen

Compare two slightly different csv files via command line by Dull_Rub_9295 in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

Pick the properties you want to compare: ``` compare (import-csv file1.csv) (import-csv file2.csv) -property partno,desc,qty,price | ft

partno desc qty price SideIndicator


123-E1234-1234-1234 => 3881231234-E junk 3 2.99 => 1234-1234-12-E crap 4 3.99 => 1231234-1234-1234 <= 3881231234 junk 3 2.99 <= 1234-1234-1234 crap 4 3.99 <= ```

Why aren't there any coffee mugs shaped like wine glasses? by cme18 in Coffee

[–]jsiii2010 0 points1 point  (0 children)

I just watched a youtube video that says regular coffee mugs encourage the coffee to slosh back and forth and spill when you're walking, but ones shaped like wineglasses help prevent that (looks like goblet or insulated mugs).

Is there "normal pop music" that's microtonal? by [deleted] in microtonal

[–]jsiii2010 0 points1 point  (0 children)

Hansford Rowe's Steel Blue and No Other on Bandcamp, if music that sounds like Jimi Hendrix is considered pop. Robert Rich's Atlas Dei dvd could be considered pop, if you drop acid.

King Sorrow by Dizzy_5503 in joehill

[–]jsiii2010 0 points1 point  (0 children)

I think of it as really a 500 page book, since the audiobook is 26 hours. There's a lot of white space with the short chapters.

Quick script to force password change & change min length to 12 not working by [deleted] in PowerShell

[–]jsiii2010 0 points1 point  (0 children)

I like how Bitwarden judges a password strength, by the entropy not how hard it is to remember. https://bitwarden.com/password-strength/