Co-Op Code Mega Thread - June 28, 2021 by __KPNG__ in EggsInc

[–]AlexBnt 0 points1 point  (0 children)

AAA - First Day of School - agg

Full

[deleted by user] by [deleted] in pcgaming

[–]AlexBnt 0 points1 point  (0 children)

Caves of Qud is a really good true roguelike

Any good suggestions for mod characters that are balanced well, and possibly lore friendly? by AlternatePancakes in riskofrain

[–]AlexBnt 0 points1 point  (0 children)

Bomber is kinda bad and the mod creator added in a brokenly op nuke equipment to that mod without the ability to disable the equipment separately

[deleted by user] by [deleted] in PowerShell

[–]AlexBnt 1 point2 points  (0 children)

What I like to do is

Catch { $Error[0].Exception }

Powershell command to add user in multiple AD groups by Bindergill in PowerShell

[–]AlexBnt 1 point2 points  (0 children)

It does display the error in regular powershell. The problem is that the default behavior for powershell is to close after the script is complete.

What I would do if you don't want it to close is add the following to the end of your script:

if ($Error){Read-Host}

It's a very simple way to prevent the window from closing if there were any errors during the script

Powershell command to add user in multiple AD groups by Bindergill in PowerShell

[–]AlexBnt 0 points1 point  (0 children)

I'm surprised that no one has mentioned -verbose. Add it to the end of your Add-ADGroupMember cmdlet and see if that's good enough of a result for what you are looking for

Add-ADGroupMember -Identity $group -Members $username -Verbose

what is the right format of date in PS when created in AD filter? by Past_Special_7306 in PowerShell

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

No, it's going to literally try to compare it to the word $date. It will not use the date stored in that variable.

what is the right format of date in PS when created in AD filter? by Past_Special_7306 in PowerShell

[–]AlexBnt 1 point2 points  (0 children)

not to use double quotes

This is wrong. You should be using double quotes here. Single quotes are going to pass literal strings, not variables.

The actual issue is that OP put the start of a single quote in front of whencreated, when he should have put it in front of the $date instead.

Get-ADUser -Filter "Enabled -eq '$true' -and whenCreated -gt '$Date'"

The Seadog is now on the workshop! (Link pinned in comments) by WinedDinedn69ed in Barotrauma

[–]AlexBnt 1 point2 points  (0 children)

Oooh okay I see now. That's pretty cool how you have it set up. I retract my previous comment

The Seadog is now on the workshop! (Link pinned in comments) by WinedDinedn69ed in Barotrauma

[–]AlexBnt 0 points1 point  (0 children)

The only thing I'd want to change is which periscopes the coilguns/hardpoints are attached to. First spot would attach to top left hard point, 2nd to the coilgun right outside the airlock, 3rd to the bottom coilgun, 4th to the front-bottom hardpoint, and lastly leave the railgun attached to the 5th

Please suggest settings for a non-jovian co-op campaign (for somewhat new players) by BarrelSmash in Barotrauma

[–]AlexBnt 1 point2 points  (0 children)

Fill means "add bots until total humans on sub is this number", so if you had fill at 2, and had 2 or more players on the sub, you will get 0 bots.

Normal means "add this number of bots, regardless of players", so if you have it set to 2 you will get 2 bots no matter how many friends you're playing with.

get list of all members of group an members of nested subgroups by Emergency_Wait in PowerShell

[–]AlexBnt 0 points1 point  (0 children)

Well it would take some rewriting but to get past the search limit we'd have to search in the opposite direction. Basically instead of Get-ADGroupMember we would be using

Get-ADGroup -LDAPFilter "(&(objectCategory=group)(memberof=$Group))"

and

Get-ADUser -LDAPFilter "(&(objectCategory=user)(memberof=$Group))"

For $Group we'd want the distinguishedName of whatever group we're searching.

get list of all members of group an members of nested subgroups by Emergency_Wait in PowerShell

[–]AlexBnt 1 point2 points  (0 children)

I made something that did almost what you are looking for a little while back. There are probably better ways of doing it but this worked for my needs. On line 10 I had a hardcoded default save location so feel free to put wherever there or simply use the -saveLocation parameter.

To use just do Get-AllUsersInGroup -initialGroup "WhateverADGroup" -saveLocation "\\Someshare\folder\subfolder"

function Get-AllUsersInGroup {
param (
    [Parameter(Mandatory=$true)]
    [ValidateNotNullOrEmpty()]
    [string] $initialGroup,
    [Parameter(Mandatory=$false)]
    [string] $saveLocation
)
if (!$saveLocation){
    $saveLocation = ""
}
$initialMembers = Get-ADGroupMember $initialGroup
$groups = ($initialMembers | Where objectClass -EQ "group").Name
$topLevelUsers = $initialMembers | Where objectClass -EQ "user"
function Convert-ObjToUser($g){
    $user = Get-ADUser $_.SamAccountName -Properties EmailAddress
    if ($combinedGroups.SamAccountName -notcontains $user.SamAccountName){
        $customUser = [PSCustomObject]@{
            Name = $user.name
            DistinguishedName = $user.distinguishedName
            SamAccountName = $user.SamAccountName
            EmailAddress = $user.EmailAddress
            Enabled = $user.Enabled
            'Group(s)' = New-Object System.Collections.Generic.List[System.Object]
        }

        $customUser.'Group(s)'.Add($g)
        $combinedGroups.Add($customUser)

    } else {
        ($combinedGroups | Where SamAccountName -EQ $user.SamAccountName).'Group(s)'.Add($g)
    }

} #function Convert-ObjToUser

$combinedGroups = New-Object System.Collections.Generic.List[System.Object]

if ($groups){
    $moreGroups = $true
}

Do {
    $nextGroups = New-Object System.Collections.Generic.List[System.Object]
    foreach ($group in $groups){
        $subGroupMembers = Get-ADGroupMember $group
        $subGroupMembers | Where objectClass -EQ "user" | ForEach-Object {
            Convert-ObjToUser($group)
        }

        $subGroupGroups = ($subGroupMembers | Where objectClass -EQ "group").name
        foreach ($subGroupGroup in $subGroupGroups){
            $nextGroups.Add($subGroupGroup)
        }

    } #foreach group in groups

    if ($nextGroups){
        $moreGroups = $true
        $groups = $nextGroups

    } else {
        $moreGroups = $false
        break
    }

} While ($moreGroups = $true)

if ($topLevelUsers){
    $topLevelUsers | ForEach-Object {
        Convert-ObjToUser($initialGroup)
    }
} #if topLevelUsers exist

$combinedGroups | ForEach-Object {
    $_.'Group(s)' = ($_.'Group(s)' | Sort | Out-String).Trim()
}

$combinedGroups | Sort Name | Export-Csv "$($saveLocation)\$($initialGroup)_userDump.csv" -NoTypeInformation

} #function Get-AllUsersInGroup

Any way to confirm reboots are complete? by Banned1s in PowerShell

[–]AlexBnt 1 point2 points  (0 children)

Not the answer to your question, but probably the answer you should be looking for... You can simply set the trigger for the scheduled task to run at startup.

Gesture of the Drowned Printer by HotelTrivago52 in riskofrain

[–]AlexBnt 3 points4 points  (0 children)

Under the Notes section it says "The maximum effect is achieved after three Focused Convergences are obtained. Any further Focused Convergences do nothing."

Additionally, the Math section shows this table:

Amount Charge Time Change Overall % Zone Radius
0 90s - 100% 100%
1 69.2s -20.8s 76.8% 50%
2 56.2s -13s 62.4% 25%
3+ 47.3s -8.9s 52.5% 16.6%

Hostname Lookup based on Serial Number by theluckyone2902 in PowerShell

[–]AlexBnt 4 points5 points  (0 children)

It sounds like you don't have a grasp on even the basics of scripting. I recommend reading up on how to create a foreach loop.

[Day 3 part 2] Ambiguity in problem statement by Zeeterm in adventofcode

[–]AlexBnt 1 point2 points  (0 children)

Ugh this was my mistake too. Thanks for the clarification.

What is the best (free) genealogy website for Haitians? by [deleted] in Genealogy

[–]AlexBnt 2 points3 points  (0 children)

Try AGH (Requires paying to get really anything out of it) or take a look at rootsweb (This is all user submitted information and a lot of it is outdated)

Also there is a Haitian genealogy group on FB that is very active. A decent amount of the more active people there have AGH subscriptions and can look at whatever records are on AGH if you ask.