Skip to content

Instantly share code, notes, and snippets.

View Juanito99's full-sized avatar

Ruben Z Juanito99

View GitHub Profile
@Juanito99
Juanito99 / Get-MSGraphData.ps1
Created May 3, 2021 20:14
Query Microsoft Graph with PowerShell
# Azure AD OAuth Application Token for Graph API
# Get OAuth token for a AAD Application (returned as $token)
$clientId = "YOUR Client ID"
$tenantId = "YOUR Tenant ID"
$clientSecret = 'YOUR Client Secret'
# Construct URI
$uri = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token"
Start-PodeServer {
New-PodeLoggingMethod -File -Name 'errors' -Path C:\WebSrv | Enable-PodeErrorLogging
New-PodeAuthScheme -Form | Add-PodeAuthWindowsLocal -Name 'WinAuth' -NoGroups -Users @('UpReader') -Sessionless
Add-PodeEndpoint -Address * -Port 8118 -Protocol Https -CertificateStoreLocation LocalMachine -CertificateName server.fqdn
Add-PodeRoute -Method Get -Path '/oemAgents' -ScriptBlock {
@Juanito99
Juanito99 / MPTuining-RulesAndUnitMonitors.ps1
Created June 13, 2018 05:03
Helps when doing Management Pack Tuning for SCOM
param(
[Parameter(Mandatory=$true)]
[string]$sourceManagementPackDisplayName,
[Parameter(Mandatory=$true)]
[string]$overrideManagementPackDisplayName,
[Parameter(Mandatory=$true)]
[ValidateSet('unitMoninitor','rule')]
[string]$itemType,
@Juanito99
Juanito99 / PartOfAPowerShellScript.ps1
Created March 27, 2018 03:59
Start a program on interactive session
Function Invoke-ScheduledTaskCreation {
<#
.Synopsis
Creates a temporary scheduled task to run the cmd-file privously created.
Required work-around as PowerShell limitation to run in the User's session interactivly.
.Example
Invoke-ScheduledTaskCreation -filenName $serverStartFile
#>
@Juanito99
Juanito99 / Get-SharesWithShareAndNTFSPermissions
Last active May 4, 2024 11:31
List File-Shares with Share and NTFS Permissions in PowerShell
<#
License terms
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#>
#get all Shares