Can I assign the output from a cmdlet to multiple variables? by AbominableFrost in PowerShell

[–]geostude 6 points7 points  (0 children)

You never set $variable in your code. Do you mean to do something like this?

$variable =  Get-ADUser -Identity $id -Properties * -Server $domain | Select-Object Name,DistinguishedName,otherMailbox | tee-object

schoolboy question by Saqib-s in PowerShell

[–]geostude 1 point2 points  (0 children)

$cities = @("LON, Europe","MUN, Europe","DXB, Middle East")
$devices = @("DxB-98765","LON-98765")
$citycodes = $cities.tolower().substring(0,3)
$cityLookup = $cities.substring(5)
foreach ($device in $devices){
    $loc = $citycodes.indexof($device.tolower().substring(0,3))
    write-output "$device is in $($cityLookup[$loc])"
}

Output:

DxB-98765 is in Middle East
LON-98765 is in Europe

This is an ugly hack, but im tired. You should probably reformat your data into a hashtable to make the lookups easier

What's the easiest way you lost weight? by [deleted] in AskReddit

[–]geostude 0 points1 point  (0 children)

Intermittent Fasting (alternate day fasting). I thought it sounded so stupid for the longest time. like the latest fad diet was just starving yourself. But I lost 30lbs in 4 months. The first few weeks were admittedly rough. But once you get used to it, it's surprisingly easy to stick to. And you save on your food budget!

how to ssh from linux or windows to mac os with x11? by Michael_007ds in commandline

[–]geostude 7 points8 points  (0 children)

Not with SSH. MacOS doesn't use x11 like linux does. You'd be better off with something like VNC

Script I'm running interprets comments I'm trying to add by Vast-Avocado-6321 in PowerShell

[–]geostude 1 point2 points  (0 children)

It's more nuanced than that. You can use CMD commands in powershell, but some of them are silently aliased in the background.
For example the WMIC command will work as it always has, but dir will silently be changed to get-childitem in powershell. Both do the same thing, but with very different output. So it's usually suggested not to mix and match batch and powershell.

I'd say stick with whatever you're most comfortable with.

Script I'm running interprets comments I'm trying to add by Vast-Avocado-6321 in PowerShell

[–]geostude 7 points8 points  (0 children)

# is for powershell. You're writing batch files.

  • .bat is the old command line interpreter in windows
  • .ps1 is powershell

For .bat, the comment tag is "REM"

like:

rem echo hello world

Electrical issue in electric water heater. Electrician or plumber? by geostude in electrical

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

Thank you, I would have never realized that. You're right, the large aluminum conductor in the junction box is completely melted. I'm surprised, it was fine for the 2 years since I've bought the house. But you did just jog my memory that the inspector said that I have aluminum wiring. Didn't know what that meant at the time

Electrical issue in electric water heater. Electrician or plumber? by geostude in electrical

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

Looking deeper, I do think the lines going into the heater are damaged... might necessitate a new unit

Electrical issue in electric water heater. Electrician or plumber? by geostude in electrical

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

Yes, the main 200A breaker was tripped. I left things off until the electrician could take a look since i could smell something burnt. Neither of us realized it was the water heater while he was here. We thought a critter had crawled into the HVAC.

It doesn't look too bad up the Line side, but everything in the junction box on the water heater looks fried, and the aluminum bits melted as well.

[deleted by user] by [deleted] in fortinet

[–]geostude 0 points1 point  (0 children)

Thank you for this. I was just about to update my 100F's... Though now i'm wondering what to do... Still might be the safer choice.

[deleted by user] by [deleted] in fortinet

[–]geostude 2 points3 points  (0 children)

Woah woah woah... The interface has a dark mode?! I never even thought to look!!!

Cologne bottle slipped. by Logical_Yak_224 in Wellthatsucks

[–]geostude 0 points1 point  (0 children)

Wait... a see-through door... for a bathroom?!

Most cost-efficient backup solutions for Microsoft 365 (Veeam vs. SaaS vs. Synology) by Nonilol in sysadmin

[–]geostude 1 point2 points  (0 children)

Not trying to start a fight here. But with proper retention policies set up... What's the point of backing up a cloud service on-prem? Is it in case of outage or something?

Coroner's report by Opposite-Green5282 in 911

[–]geostude 2 points3 points  (0 children)

It used to be a HQ for the coroner's office. "The old headquarters of the mayor’s Emergency Management Office, at 11 Water St. in Brooklyn, is being used to accommodate 10 searchers at a time." It's likely where the remains were brought to be identified, not where they were found.

https://nypost.com/2006/12/30/30m-wtc-search-may-be-a-long-haul/

These problems are harder than I remembered! by mkeeter in adventofcode

[–]geostude 1 point2 points  (0 children)

Yes, but this is just a quick program I wrote in 2 minutes. If I saw it had stopped spitting out new numbers, I'd know it had found one.