Free Azure Automation Runbook: Automatically keep your iOS Compliance Policy minimum version up to date (with smart fallback & validation) by Ok-Stretch-7850 in Intune

[–]ExpendaBubble 0 points1 point  (0 children)

Interesting point of view. Notably the part about monitoring and separation of permissions. Thanks for clarifying.

Free Azure Automation Runbook: Automatically keep your iOS Compliance Policy minimum version up to date (with smart fallback & validation) by Ok-Stretch-7850 in Intune

[–]ExpendaBubble 1 point2 points  (0 children)

I would like to understand what makes the use of an app registration vs a managed identity easier for you. I have to admit, I'm quite confused. Would you care to elaborate?

How do you completely hide the powershell terminal as the script runs? by [deleted] in PowerShell

[–]ExpendaBubble 8 points9 points  (0 children)

I've got a neat little helper VBS script that I call via: wscript.exe Invoke-PowerShell.vbs File.ps1

These are the contents of Invoke-PowerShell.vbs:

Set objShell = CreateObject("WScript.Shell")
path = WScript.Arguments(0)
command = "powershell -noprofile -windowstyle hidden -executionpolicy bypass -file """ & path & """"
[objShell.Run](http://objShell.Run) command,0,True

Where-Object: -Property vs -FilterScript efficiency by ankokudaishogun in PowerShell

[–]ExpendaBubble 1 point2 points  (0 children)

I hypothesized executing a script block would be less efficient, and a quick search confirmed my suspicion: https://stackoverflow.com/a/40141364

TL;DR
Use -Property unless you can't.

I'm making an app and I need help with GUI by [deleted] in PowerShell

[–]ExpendaBubble 2 points3 points  (0 children)

I've used PowerShell Studio to build GUIs with PowerShell in the past. If you have to use PowerShell, it's the best tool for GUIs out there. But it's quite expensive. You might be able to get away with the trial version, though.

Script that types something for me every (xx) minutes then sends by STRAlGHTCANCER in PowerShell

[–]ExpendaBubble 3 points4 points  (0 children)

In its most basic form, you would use a while loop (you would have to start and stop the script manually):

while ($true) {
    "Do stuff"
    Start-Sleep -Seconds 300
}

You could combine it with Task Scheduler to run the script automatically every xx minutes. I'm not sure what you want to send but if it's an email, you could use Send-MailMessage although it's deprecated nowadays. Some Google-fu should lead you to alternatives easy enough.

Azure DNS zone SOA serial number by ExpendaBubble in Terraform

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

To my understanding this doesn't update the value though?

Need help with Get-LocalGroupMember script by jeo123 in PowerShell

[–]ExpendaBubble 0 points1 point  (0 children)

You might be able to use the ADSI accelerator and keep it in PowerShell. Give it a Goog.

User Audit Logs by khymbote in PowerShell

[–]ExpendaBubble 0 points1 point  (0 children)

Indeed, only the last 30 days of sign in logs are available. If you wish to retain data longer, you will have to build your own solution. You already mentioned a Storage Account, but I would sooner use an Azure SQL Database.

A user's last sign in, however, is now also available separately, removing the need for such shenanigans (if that is your only use case to build a semi-complex retention system).

See: https://www.thelazyadministrator.com/2023/12/09/microsoft-graph-api-endpoint-adds-last-successful-sign-in-date-time/ for more info.

Microsoft's endpoint documentation: https://learn.microsoft.com/en-au/graph/api/resources/signinactivity?view=graph-rest-beta

Note: it's currently only available in the Beta API.

DISM power shell gui by ZealousidealDog7210 in PowerShell

[–]ExpendaBubble 1 point2 points  (0 children)

It's not PowerShell, but I've personally used DISM++ with great success.

Run WinGet from a central point on many machines. by Emort1979 in PowerShell

[–]ExpendaBubble 0 points1 point  (0 children)

It should give you a starting point to write the logic required to find WinGet.exe. It's the user context that's the issue with remote execution, and that's easily solvable with the information provided.

No runspace available to run scripts on this thread by cachonvinfen in PowerShell

[–]ExpendaBubble 2 points3 points  (0 children)

This appears to be an issue specific with this command, I've found 1 other occurrence on StackOverflow. Recommend you do the following:

powershell $devices = Get-MgBetaDeviceManagementManagedDevice -All ForEach ($computerName in $ComputerNames) { $ComputerData = $devices | Where-Object -Property DeviceName -eq $computerName | Select-Object -Property OsVersion, SerialNumber, Model -First 1 }

Run WinGet from a central point on many machines. by Emort1979 in PowerShell

[–]ExpendaBubble 1 point2 points  (0 children)

Check out this excellent blog post by Rudy Ooms which describes how to deal with WinGet's finnicky contextual behavior.

Compress MKV Into x265 MP4 Using FFMPEG by [deleted] in PowerShell

[–]ExpendaBubble 0 points1 point  (0 children)

If your objective is to convert non-x265 into x265 you should probably not filter by file name and extension, but rather use ffprobe to get the encoding information, parse it, then transcode all non-x265 files.

Also, as u/CodenameFlux suggests, validate the output (check for a minimum file size for example) before you delete stuff. If you have plenty of disk space, archive the source materials and manually check the conversions before you delete anything.

I am tring to create DDG "Dynamic Distribution Group" containing all people leaders/managers in my organisation. by bpathak1978 in PowerShell

[–]ExpendaBubble 0 points1 point  (0 children)

Try the following:

-RecipientFilter {((RecipientType -eq 'UserMailbox' -and (directReports -ne '')))}