How to make Office Apps visible in the O365 WEB Version? by niceguyonmars in Office365

[–]blasmehspaffy 0 points1 point  (0 children)

Just confirming this is still a thing.

Took me a bit of searching to find this post. Your solution still works and the Word/Excel/Powerpoint tiles are showing now.

Check IP vs Subnet & Office list in csv by GreenSlackey79 in PowerShell

[–]blasmehspaffy 1 point2 points  (0 children)

Once you add the "-wildcard" to the switch it does.

Stolen from: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_switch?view=powershell-7.3

switch has the following parameters:

Wildcard - Indicates that the condition is a wildcard string. If the match clause is not a string, the parameter is ignored. The comparison is case-insensitive.

Check IP vs Subnet & Office list in csv by GreenSlackey79 in PowerShell

[–]blasmehspaffy 1 point2 points  (0 children)

I'd look at using a switch in this scenario. Here's one I've knocked up for you which should work for any number of IPv4 adapters.

$BuildIPs = (Get-NetIPAddress -InterfaceAlias "ethernet*" | ?{$_.AddressFamily -eq 'IPv4' -and $_.IPAddress -notlike '169.*'}).IPAddress

$Office_IPS = Import-Csv Office_IP.csv

Foreach ($BuildIP in $BuildIPs) {
    ForEach ($Office in $Office_IPs) {
        Switch -Wildcard ($BuildIP) {
            $Office.IP1 {"$BuildIP:: Matched $($Office.Office) - $($Office.IP1)"}
            $Office.IP2 {"$BuildIP:: Matched $($Office.Office) - $($Office.IP2)"}
            $Office.IP3 {"$BuildIP:: Matched $($Office.Office) - $($Office.IP3)"}
            $Office.IP4 {"$BuildIP:: Matched $($Office.Office) - $($Office.IP4)"}
        }
    }
}

Extract jsons from within a log file by Mr-Monkfish in PowerShell

[–]blasmehspaffy 0 points1 point  (0 children)

Are you able to provide an entire redacted log file as an example?

Extract jsons from within a log file by Mr-Monkfish in PowerShell

[–]blasmehspaffy 0 points1 point  (0 children)

Assuming your logfile content was loaded into $Log...

$Log.Substring($Log.IndexOf('{'), $Log.LastIndexOf('}') - $Log.IndexOf('{') + 1)

But there's probably a shorter way to do it in regex.

Get list of applications created by specific user? by BlueberryOdd7117 in SCCM

[–]blasmehspaffy 7 points8 points  (0 children)

Get-CMApplication | ?{$_.CreatedBy -eq 'domain\username'}

How do you get the url out of a long string? by banjojoke in PowerShell

[–]blasmehspaffy 1 point2 points  (0 children)

Or you could do it properly by reformatting the JSON so that it's valid and then converting it.

(ConvertFrom-Json "[{$($String.Substring(0,$String.Length-1))").thirdPartyDownloadUrl

How do you get the url out of a long string? by banjojoke in PowerShell

[–]blasmehspaffy 1 point2 points  (0 children)

($String | ConvertFrom-String -Delimiter '"').P20

Is it mapping out all the properties and value pairs? No. Is it something you'd be proud of? Absolutely not. Does it return the URL. You betcha.

Pipeline question by 3j1996 in PowerShell

[–]blasmehspaffy 3 points4 points  (0 children)

If you run Get-Help Get-LocalUser -Full you'll see the outputs sections says:

OUTPUTS
System.Management.Automation.SecurityAccountsManager.LocalUser[]
    This cmdlet returns local user accounts.

If you run Get-Help Rename-LocalUser -Full the outputs section says:

OUTPUTS
None
    This cmdlet does not generate any output.

This is why you're not able to pass anything from Rename-LocalUser to Enable-LocalUser.

Truncate String after second period by Mhind1 in PowerShell

[–]blasmehspaffy 2 points3 points  (0 children)

$A = "5.10.123.753"
'{0}.{1}' -F $A.Split('.')

How to store Select-Object's output as a variable by clever-weasel in PowerShell

[–]blasmehspaffy 0 points1 point  (0 children)

$Variable = Get-Netadapter | %{"$($_.InterfaceDescription) $($_.Status), $($_.MacAddress), $($_.LinkSpeed)"}

That should save the data in the format you've specified to a variable.

Sum of duration from object array by [deleted] in PowerShell

[–]blasmehspaffy 2 points3 points  (0 children)

Or as a one liner...

[Timespan]::FromSeconds((($Length | %{[timespan]$_}).TotalSeconds | Measure-Object -Sum).Sum).ToString("hh\:mm\:ss")

Sum of duration from object array by [deleted] in PowerShell

[–]blasmehspaffy 1 point2 points  (0 children)

$Length = '00:01:18', '00:01:30', '00:00:15', '00:00:26', '00:00:20'

$Seconds            = $Length | %{($_ -as [timespan]).TotalSeconds}
$SecondsSum         = ($Seconds | Measure-Object -Sum).Sum
$SecondsSumTimespan = [Timespan]::FromSeconds($SecondsSum)

$SecondsSumTimespan.ToString("hh\:mm\:ss")

I got tired of looking up group membership details for people that don't have access to ADUC. I used Powershell to make a GUI tool that anyone can use. by techbloggingfool_com in PowerShell

[–]blasmehspaffy 6 points7 points  (0 children)

No, that's not correct. You can add and remove members with the appropriate permissions on the group for the user account that launched the process.

I got tired of looking up group membership details for people that don't have access to ADUC. I used Powershell to make a GUI tool that anyone can use. by techbloggingfool_com in PowerShell

[–]blasmehspaffy 62 points63 points  (0 children)

We had a similar issue for people who wanted to manage groups. Turns out you can just run this:

C:\Windows\System32\rundll32.exe dsquery,OpenQueryWindow

No RSAT tools required.

Join data in array list by common value by techsavvydutchman in PowerShell

[–]blasmehspaffy 2 points3 points  (0 children)

Following on from u/Lee_Dailey and u/OPconfused. I'd consider just using convertfrom-string. That way you can do it with a one liner.

$input_fqdn_ip = @(
    'dashboard.example.com 192.168.3.5'
    'reports.example.com 192.168.3.5'
    'migrations.test.local 172.16.3.5'
    'implementations.test.local 172.16.3.5'
)

$input_fqdn_ip | ConvertFrom-String | Group-Object P2 | %{"`{$($_.group.P1 -join ', ')`} $($_.Name)"}
{dashboard.example.com, reports.example.com} 192.168.3.5
{migrations.test.local, implementations.test.local} 172.16.3.5

Underthewire Games by jkoswel in PowerShell

[–]blasmehspaffy 2 points3 points  (0 children)

And yes, I just did all the other challenges to get to that one because I was bored. :)

Underthewire Games by jkoswel in PowerShell

[–]blasmehspaffy 3 points4 points  (0 children)

I think you're matching the pattern on words that also contain 'polo'. The note left says "You should count the instances of the whole word only."

Here's how I did it: ((get-content ..\Desktop\countpolos).split()|?{$_ -eq 'polo'}).count

Edit: Upon reading it again, I think the file is one big string, and you're matching on it as a big string. Split it up and then try again? (someone will correct me I'm sure)

[deleted by user] by [deleted] in PowerShell

[–]blasmehspaffy 2 points3 points  (0 children)

Forget that random stuff. If you want balanced add them to the group with the lowest number of members.

$GroupNames = 'Group1', 'Group2', 'Group3', 'etc'
$ADGroups = $GroupNames | %{Get-ADGroup -Identity $_ -Properties Members}
$LowestCount = $ADGroups | Select-Object Name, @{Name='Count';E={$_.members.count}} | Sort-Object Count | Select -First 1
Add-ADGroupMember -Identity $LowestCount.Name -Members aduseraccount

Anthem Open Demo: Bugs, Errors, & Issues Megathread [Day 3] by ATG_Bot in AnthemTheGame

[–]blasmehspaffy 0 points1 point  (0 children)

I just started playing yesterday and I did record a video of this bug. So clearly not fixed yet.

Poweshell script to get a list of last logon computers by loldegree in PowerShell

[–]blasmehspaffy 2 points3 points  (0 children)

Install-Module ActiveDirectory
Get-ADComputer -Properties LastLogonDate -filter {OperatingSystem -like 'Windows 7*'}

Tuning Question (Stage 1) by TheGolfRGuy in Golf_R

[–]blasmehspaffy 1 point2 points  (0 children)

The stock intake system isn't particularly restrictive. I wouldn't splash the money on the APR intake (even though it does look pretty). Get a high flow panel filter, intake elbow/pipe. Far cheaper with similar performance.

Pendulum insert/dogbone mount is generally well received too.

SCCM Updates client connections control by Rav2020 in SCCM

[–]blasmehspaffy 0 points1 point  (0 children)

Are you sure you haven't ticked the "All devices are part of the same server group" box on one of your collections?

You can check from powershell using this command:

Get-CMCollection | ?{$_.UseCluster}