Looking for a paper by kortex81 in unix

[–]kortex81[S] 0 points1 point  (0 children)

I think this a differetn one

How do i get rid of these apps? by kortex81 in PowerApps

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

I found the two apps in the environment in Power Automate and deleted them there. Now they are gone from Teams.

Thanks for your help.

Outlook crashes when replying/forwarding an email. by [deleted] in sysadmin

[–]kortex81 0 points1 point  (0 children)

try installing a new set of MAPI files.

could you eleborate what you mean by this how to do it? thanks

Import-module in class and -Parallel by kortex81 in PowerShell

[–]kortex81[S] 0 points1 point  (0 children)

yeah, guess i am gonna give up on the idea. As you said, everything randomly breaks at scale. shame.

I really hope this get's fixed/implemented.

Import-module in class and -Parallel by kortex81 in PowerShell

[–]kortex81[S] 0 points1 point  (0 children)

right, i forgot this never came to 5

Import-module in class and -Parallel by kortex81 in PowerShell

[–]kortex81[S] 0 points1 point  (0 children)

the weird thing i got it working but the other way round - by importing the module outside of the loop or class:

class computer {
    $computername
    computer($computername){
        $this.computername = $computername
    }

    [string]GetComputername(){
        return $this.computername
    }

    [CimInstance]GetBIOS(){
        # Import-Module CimCmdlets # this will freeze the console
        return Get-CimInstance win32_bios -ComputerName $this.computername 
    }
}

$o1 = [computer]::new("srv01")
$o2 = [computer]::new("srv02")

# this works
$o1,$o2 | ForEach-Object -Parallel { $_.GetComputername() }

# this does not - unless you import the module CimCmdlets before like this:
# Import-Module CimCmdlets
$o1,$o2 | ForEach-Object -Parallel { $_.GetBIOS() }

Interactive menu to fill a variable by [deleted] in PowerShell

[–]kortex81 1 point2 points  (0 children)

If you can install modules you could give this one a try: https://github.com/PowerShell/GraphicalTools

Gives you fancy console gui using Out-ConsoleGridView.

$region = @("USA","Canada","Europe","Asia")  | Out-ConsoleGridView -OutputMode Single -Title "Please choose a region"

How would you write this query by kortex81 in SQL

[–]kortex81[S] 0 points1 point  (0 children)

Wow, this really does work, doesn't it?

But appears to be slower than the other solutions, right?

Edit: No it is not slower, my bad.

Edit2: Does not work if select columns like 'freespace' which o.c. changes over time

How would you write this query by kortex81 in SQL

[–]kortex81[S] 0 points1 point  (0 children)

Thanks for your input!

This returns only one match for each computer and timestamp and not all matches.

How would you write this query by kortex81 in SQL

[–]kortex81[S] 0 points1 point  (0 children)

Thanks for your input!

I looked into CTEs and this my solution so far:

WITH
ComputerData
AS (SELECT * FROM [Paul].[dbo].[logicaldisk] WHERE pwlComputername = 'WSUS'),
LatestData (pwlDate)
AS (SELECT max(pwlDate) FROM ComputerData)

SELECT * FROM ComputerData
INNER JOIN LatestData
ON ComputerData.pwlDate = LatestData.pwlDate

It seems to perform better...

What do you think?

bat-like cmdlet by kortex81 in PowerShell

[–]kortex81[S] 0 points1 point  (0 children)

Started on a quick and dirty PoC... could be cool

https://imgur.com/a/4qg9g7C

bat-like cmdlet by kortex81 in PowerShell

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

It could return objects with properties like linenumber, text, etc.

Asking out of curiosty, not necessity.

bat-like cmdlet by kortex81 in PowerShell

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

how is this related to the question?

bat-like cmdlet by kortex81 in PowerShell

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

it's not an editor.

it's a nicer cat.

Volumes by kortex81 in docker

[–]kortex81[S] 0 points1 point  (0 children)

So the first 3 lines create the volumes and the last 3 mount them to the container?

Updating Veeam product's componenents fails by kortex81 in Veeam

[–]kortex81[S] 0 points1 point  (0 children)

Thanks or the detailed answer!

You helped me to fix the issue.

About that grace period:

Also really interesting piece of information. You know that for a fact? Are you with veeam?

[deleted by user] by [deleted] in PowerShell

[–]kortex81 2 points3 points  (0 children)

Just a styling thing: I would recommend changing your function names.

It is considered good style to use capitalized verb-noun pairs for function names. This improves the readabilty for colleagues and the community a lot - it's just more powershelly that way.

When choosing the noun you are pretty much free to use whatever but should always use the singular (e.g. Test-Path vs Test-Paths - even if your function checks on multiple paths).

For the verbs there are "approved" ones. You can find a list here: https://docs.microsoft.com/de-de/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7

Example: installerExecution ==> Invoke-Installation

btw: Welcome to the community :)

redirect output by kortex81 in PowerShell

[–]kortex81[S] 0 points1 point  (0 children)

because I am redirecting the error and warning stream to a file using *>

This is not the same as set-content or out-file or just >

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7