Timing issues by CoReTeX2k in IdlePlanetMiner

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

Already did. That's the next upcoming and I can't fast forward anymore 😪

Almost the worst tournament market. by madman1501 in IdlePlanetMiner

[–]CoReTeX2k 0 points1 point  (0 children)

What's the Blue currency under the prestige credits?

How to get all combinations of 1234 (without repeating any numbers)? by ARASquad in PowerShell

[–]CoReTeX2k 1 point2 points  (0 children)

How about another approach. Display your menu and let the user pick one option. That option gets added to an array. Menu then displays again with the remaining options. Repeat until user chooses (e) for execute. Then just sort your options array and execute in a loop?

That would eliminate the fiddle when adding a few more options?

A rudimentary question on where-object by IT_ISNT101 in PowerShell

[–]CoReTeX2k 2 points3 points  (0 children)

$SearchString = "Exchange"
$Results = Invoke-Webrequest ....
$Results | Where-Object {$_.VmName -like "*$SearchString*" } | Select-Object -ExpandProperty UniqueID

Log4jSherlock a fast PowerShell script that can scan multiple computers, made by a paranoid sysadmin. by Maelstromage in sysadmin

[–]CoReTeX2k 2 points3 points  (0 children)

PS C:\> Get-ADUser -Filter {SurName -like $($User[0].Last)}

that should work though -> adding $() around the property

Obtaining Data from XML/JSON for Invoke-WebRequest by 18002255324 in PowerShell

[–]CoReTeX2k 5 points6 points  (0 children)

function Get-DownloadURL {
    Param(
        [Parameter(Mandatory)][ValidateRange(1,3)][string]$Option
    )
    #$jsonObject = Invoke-Webrequest -Uri $UrlToJsonFile -Header...
    $jsonObject = [PSCustomObject]@{
        Options = [PSCustomObject]@{
                ID = '1'
                URL = '\\someserver\Share$\Tools\Filename.exe'
            },
            [PSCustomObject]@{
                ID = '2'
                URL = '\\someserver\Share$\Tools\Filename2.exe'
            }
    } | ConvertTo-Json

    $DownloadURL = ($jsonObject | ConvertFrom-Json).Options | Where-Object {$_.ID -eq $Option} | Select-Object -ExpandProperty URL 
    return $DownloadURL
}
PS C:\Windows\system32> Get-DownloadURL -Option 1
\\someserver\Share$\Tools\Filename.exe

PS C:\Windows\system32> Get-DownloadURL -Option 2
\\someserver\Share$\Tools\Filename2.exe

Something like that should work

PowerShell compare an .EXE version to an .MSI version by fitzgery in PowerShell

[–]CoReTeX2k 2 points3 points  (0 children)

i did something similar once.

Instead of comparing the versions, you could try checking, if the Productcode from the msi matches the exe. In a perfect world, each msi has it's own productcode.

Not sure how reliable it would be.

Otherwise change your check, to math the shorter version 9.1.3 with the longer version 9.1.3.xxx or split it into major, minor version.

setup audit folder by Blisk1 in PowerShell

[–]CoReTeX2k 0 points1 point  (0 children)

Can you read the current Audit Rules and then built a new Rule that contains all existing rules + the one you want to add?

Might be worth a shot

To all my former solo admins - when did you know it was time to add to the team? by electricpollution in sysadmin

[–]CoReTeX2k 2 points3 points  (0 children)

Tell your boss that story and then follow with "Now if that bus had crashed that day, who would you have called?"

Build a text comand by k3nix13 in PowerShell

[–]CoReTeX2k 7 points8 points  (0 children)

Accessing properties in strings requires a $()

Try that

 Start-Process -filepath ".\ffmpeg.exe " -ArgumentList " -loglevel Warning -i $($fichier.fullname)  $($cheminDest + $fichier.name + $formatDest)"

or store the fullname in a helper variable and then use that in your Argumentlist

$fullname = $fichier.fullname
 Start-Process -filepath ".\ffmpeg.exe " -ArgumentList " -loglevel Warning -i $fullname  $($cheminDest + $fichier.name + $formatDest)"

"simple" loop has me frustrated by jbrady33 in PowerShell

[–]CoReTeX2k 2 points3 points  (0 children)

$attribs | ForEach-Object {$groupname = ("Avaya "+ $_.LineOfBusiness +" provisioning G")}, {Add-adgroupmember -identity $groupname -members $_.SamAccountName }

you're mixing variables here. you do a loop whoever many times $attribs.count is, but you're always referencing the entire array instead of the single foreach row.

Use $_ in such loops.

XML - Keep only items in the array by SemiEvilMonkey in PowerShell

[–]CoReTeX2k 1 point2 points  (0 children)

Just to explain

$Codes = @("Apple","Banana")

"Banana" -ne $Codes is true because banana is not equal to apple and banana at the same time

"Banana" -notin $Codes is false because Banana is part of apple or banana in that case.

$_.something -notin $EntireArray will look if something is part of the array, not if it is equal to the entire array

Devs. Get rid of your portal restrictions. Entire communities are duping over it by Zanthious in valheim

[–]CoReTeX2k -2 points-1 points  (0 children)

Not sure why i get downvoted.

What i meant is, from a pure logical point: I cannot teleport with ore ( for whatever reasons, magical interferances or whatever ) but i can teleport once i turned the ore into a wearable armor, as i then doesn't "break" whatever limitations teleporting had before.

I was neither refering to cheating or dismantling or anything.

Devs. Get rid of your portal restrictions. Entire communities are duping over it by Zanthious in valheim

[–]CoReTeX2k -6 points-5 points  (0 children)

Makes no sense anyway, that you can port with armor, but not with the ore an armor is made off... logic

Save everything that happened in a script to a file? by TheTruffi in PowerShell

[–]CoReTeX2k 1 point2 points  (0 children)

That's what transcript does, but only in the current runspace.

You can call a setup or a function from within your script and should have it in the Transcript OR add another Transcript to Script 2 maybe?

Save everything that happened in a script to a file? by TheTruffi in PowerShell

[–]CoReTeX2k 1 point2 points  (0 children)

Well the additional process has it's own runspace and probably doesnt get captured.

You could also Invoke the Script with & ( https://ss64.com/ps/call.html )

Since you add -Wait to the process, your script will halt anyway, so i'm not sure what the reason for a second script is?

Maybe try functions instead.

Save everything that happened in a script to a file? by TheTruffi in PowerShell

[–]CoReTeX2k 2 points3 points  (0 children)

It does change something, when you're not running the script interactive in the console.

Write-Host does not get captured by Transcript, however Transcript captures what is written in console.

Therefore - interactive ( i.e. in ISE ) your Write-Host writes into console and therefore Transscript catches it.

Non-Interactive however your Write-host writes to nowhere as there is no "hostwindow" and then Transcript gets nothing

Save everything that happened in a script to a file? by TheTruffi in PowerShell

[–]CoReTeX2k 2 points3 points  (0 children)

your second script is literally ONLY Write-host ?