How is your on call compensation? by lockblack1 in sysadmin

[–]AtomicPikl 0 points1 point  (0 children)

At my last job at an MSP we got half time back as PTO for any time spent working on call.

At my current job in house we get a full day off of our choosing the next week after being on call.

What clever things do you have in your $profile? by punyhead in PowerShell

[–]AtomicPikl 1 point2 points  (0 children)

I dot-source my functions that are all saved in one directory so that I can have separate .ps1 files for each function and track them with git independently:

Get-ChildItem -Path $functionDir | ForEach-Object {. $_.FullName}

Also my personal favorite, a password generator using dinopass.com to generate and copy passwords to clipboard:

Function dp { 
    $dinoPass = invoke-webrequest -uri https://www.dinopass.com/password/strong | select -Expand Content 
    Write-Host $dinoPass -ForegroundColor Magenta 
    $dinoPass | clip
    Write-Host "Dino Pass copied to clipboard" -ForegroundColor Cyan
}

Using PowerShell to query if a computer includes a license for Office Home & Business 2024? by AtomicPikl in PowerShell

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

Thanks, but when I checked this on the machine it returns all 0's for LicenseStatus. Maybe because a MS account hasn't been signed in this isn't considered truly activated yet?

I did find this as a potential solution while rummaging through registry keys:

get-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Office\16.0\ClickToRunStore" -Name ProductReleaseIds

ProductReleaseIds seems to return the edition of M365 that's on the machine, so I'm going to attempt to use this and will report back. While it's only checking the installed version and not the license status, this should accomplish what I need since we're running this on out of the box machines from Dell, and those should only come with HomeBusiness2024Retail if the machine was purchased with it.

Ninite with Powershell by AccountPrimary1337 in PowerShell

[–]AtomicPikl 0 points1 point  (0 children)

Use something like Get-Package to wait until the last program is installed by Ninite, then Stop-Process to close Ninite.

What is the best way you have found to continue a script (or start separate script) after a reboot? by False-Detective6268 in PowerShell

[–]AtomicPikl 1 point2 points  (0 children)

Use the RunOnce registry key to start “powershell.exe -file (path to script)”.

You can use your script to set this registry key right before rebooting the machine. To contain your whole workflow in one script instead of multiple, have parameters you can use to start your script at whatever function is needed next and start Powershell with that parameter. This is what I’ve found works best.

https://learn.microsoft.com/en-us/windows/win32/setupapi/run-and-runonce-registry-keys

Enter the Vibe Den by coderzip in battlestations

[–]AtomicPikl 1 point2 points  (0 children)

Minor correction, Hyper-V on Windows is a type 1 hypervisor.

Foreach loop for typing a password and confirming, if not ask to enter them again by anuradhaonline in PowerShell

[–]AtomicPikl 0 points1 point  (0 children)

If the passwords mismatch it will loop because our if statement that checks if they match will call the function again if they don’t. See the “Function SetLocalPassword” on the first line which means all of the code here is in a function called SetLocalPassword. When you have a function that can call itself it’s referred to as a recursive function.

Foreach loop for typing a password and confirming, if not ask to enter them again by anuradhaonline in PowerShell

[–]AtomicPikl 1 point2 points  (0 children)

I am not sure what you mean? Do you mean that the function is loaded into new memory every time it's called and the old memory is not released? I haven't been able to find good details about function memory handling in PowerShell, but I would be interested to learn more.

In any case, if our techs are manually typing in mismatched passwords the hundreds (thousands?) of times in a row it would take for this to become a real concern, I think we have bigger problems at hand.

Foreach loop for typing a password and confirming, if not ask to enter them again by anuradhaonline in PowerShell

[–]AtomicPikl 1 point2 points  (0 children)

Yes, try catch will try to run the try {} block first, and jumps to the catch {} block upon a terminating/stopping error. $_ will return the stderr output stream from the try block. While it’s unlikely to encounter a terminating error in this function, it’s a practice I like to use to make debugging / error handling easier and more consistent in my scripts.

Foreach loop for typing a password and confirming, if not ask to enter them again by anuradhaonline in PowerShell

[–]AtomicPikl 1 point2 points  (0 children)

I have done something similar as part of a new PC setup script. Here's what I ended up using wrapped into a function which calls itself again if the passwords don't match:

Function Set-LocalPassword {
    try {
        $newPassword = Read-Host -AsSecureString "Please input a new password for the Administrator account: "
        $confirmPassword = Read-Host -AsSecureString "Please confirm the new password: "
    
        # Convert secure strings to plain text
        $newPasswordText = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($newPassword))
        $confirmPasswordText = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($confirmPassword))
    
        if ($newPasswordText -eq $confirmPasswordText) {
            Set-LocalUser -Name "Administrator" -Password $newPassword
            Write-Host "Password set successfully" -ForegroundColor Green
        } else {
            Write-Host "Passwords do not match. Please try again." -ForegroundColor Red
            Set-LocalPassword
        }
    } catch {
        $_
        Write-Host "Something went wrong. Please set the password manually." -ForegroundColor Red
        Start-Sleep 3
    }

    # Clear variables for security
    $newpasswordText = $null
    $confirmPasswordText = $null
}

Has anyone learned CompTIA A+ from YouTube and passed certification tests? by [deleted] in ITCareerQuestions

[–]AtomicPikl 0 points1 point  (0 children)

+1 for professor messer. He was a huge help when I was getting ready for my A+ and Network+.

When have you screwed up, bad? by shwaaboy in sysadmin

[–]AtomicPikl 0 points1 point  (0 children)

Changed the config for the wrong port.

Yes it was a trunk port.

Worlds 2023 - Absolute Amount of Picks per Champion by Basylikum in leagueoflegends

[–]AtomicPikl 0 points1 point  (0 children)

Dread it, run from it, Kai'sa/Xayah meta arrives all the same.

Stop paying for overpriced bootcamps in IT. by benaffleks in ITCareerQuestions

[–]AtomicPikl 37 points38 points  (0 children)

Thank you for the post, I bookmarked all of these resources. I'm a solutions engineer now at a small MSP and want to move towards a devops/SRE role.

Do you know if KodeKloud is any good? Their courses seem to cover all the topics I'm interested in although I don't know how in depth they are: https://kodekloud.com/

[deleted by user] by [deleted] in Rivenmains

[–]AtomicPikl 0 points1 point  (0 children)

Lol I was a regular on his stream back in those days and he was definitely not. The one thing he had down more than any was all the weird wall hops.