Skip to content

Instantly share code, notes, and snippets.

View hansgafriedzal's full-sized avatar

Hans hansgafriedzal

View GitHub Profile
<#
CSV FORMAT
+------------+--------------+--------------+
| Group Name | Group Owner1 | Group Owner2 |
+------------+--------------+--------------+
| group1 | user@domain | user@domain |
| group2 | user@domain | user@domain |
| group3 | user@domain | user@domain |
@hansgafriedzal
hansgafriedzal / Get-AzureADUserDirectoryRole.ps1
Last active September 17, 2021 06:23
Get MSOL users and their AAD directory roles.
function Get-AzureADUserDirectoryRole {
param
(
[Parameter(ValueFromPipeline = $true)]
[Microsoft.Online.Administration.User] $User
)
BEGIN {
$_directoryRoles = Get-AzureADDirectoryRole
$_directoryRoleMembers = $_directoryRoles | %{
@hansgafriedzal
hansgafriedzal / Get-AzureADApplicationServicePrincipalPermission.ps1
Last active August 20, 2020 18:55
Get Azure AD applications and their API permissions.
$searchString = ''
$_servicePrincipals = Get-AzureADServicePrincipal -All 1
[PSCustomObject] @{
Applications = Get-AzureADApplication -All 1 -SearchString $searchString | %{
$_requiredResourceAccess = $_.RequiredResourceAccess.ResourceAccess
[PSCustomObject] @{
ApplicationName = $_.DisplayName
dir *.m2ts `
| %{ "file '$($_.Name)'"} `
| Out-File mylist.txt -Encoding ascii
# copy video
# transcode audio to aac
# - copying pcm_bluray will produce audio error
# - transcoding to pcm_s16be will make the stream unreadable
ffmpeg -f concat -safe 0 -i mylist.txt -c:v copy -c:a aac output.ts -y
$userid = '1234567'
$uri = "https://cy.cyworld.com/home/$userid/posts"
$timestamp = Get-Date -format "yyyyMMddHHmmss"
$outputPath = "$([Environment]::GetFolderPath("Desktop"))\$userid\$timestamp\"
mkdir $outputPath -ErrorAction SilentlyContinue > $null
$origin = ([datetime]'1/1/1970')
$headers = @{
"Accept"="application/json, text/javascript, */*; q=0.01"
$url = @{
browser = $null
hangouts = 'hangouts.google.com'
calendar = 'calendar.google.com'
gmail = 'mail.google.com'
whatsapp = 'web.whatsapp.com'
keep = 'keep.google.com'
meet = 'meet.google.com'
teams = 'teams.microsoft.com'
}
function Export-All-XSPSolution ($Location)
{
$farm = Get-SPFarm
If (test-path $Location) {} Else {mkdir $Location}
Write-Host "Downloading..."
$farm.Solutions
foreach($solution in $farm.Solutions){
$solution = $farm.Solutions[$solution.Name]
$farm = Get-SPFarm
$farm.Solutions `
| sort name `
| ft Name, Deployed, DeployedWebApplications, DeployedServers, DeploymentState
@hansgafriedzal
hansgafriedzal / Log-MsolSubscription.ps1
Last active July 23, 2020 03:21
Append response from Get-MsolSubscription into a csv file in the desktop. Call Connect-MsolService before running this.
function Log-MsolSubscription
{
begin
{
$timestamp = Get-Date -format "yyyyMMddHHmmss"
$executionName = $MyInvocation.MyCommand
$logFilename = "$($timestamp)_$(gc env:computername)_$($executionName)"
$logPath = "$([Environment]::GetFolderPath("Desktop"))\$executionName\$logFilename.log"
Start-Transcript -Path $logPath > $null
}
function Get-BrowserProfile {
param
(
[Parameter(Position=0)]
[ValidateSet('chrome','msedge','All')]
$Browser = 'All',
$Email
)
$browsers = @{}