Skip to content

Instantly share code, notes, and snippets.

Anatoly Mironov mirontoli

Block or report user

Report or block mirontoli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View update-site-locale-pnp.ps1
Connect-PnPOnline https://takana16.sharepoint.com/sites/001
$web = Get-PnPWeb
$ctx = Get-PnPContext
$ctx.Load($web.RegionalSettings)
$ctx.ExecuteQuery()
$tz = $web.RegionalSettings.TimeZones.GetById(4) # Stockholm, UTC+1
$web.RegionalSettings.Timezone = $tz
$web.RegionalSettings.LocaleId = 1053 # Swedish
$web.RegionalSettings.FirstDayOfWeek = 1 # Monday
$web.RegionalSettings.Time24 = $true
View pnp.ps1
# Install
Install-Module SharePointPnPPowerShellOnline -Scope CurrentUser
# check version
Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
# Update
Update-Module SharePointPnPPowerShell*
# connect with mfa
Connect-PnPOnline -Url https://takana15.sharepoint.com/sites/tolle016 -SPOManagementShell -ClearTokenCache
# get template; you need to extract it, it is just a zip file
Get-PnPProvisioningTemplate -out template.pnp
View msgraph-commands.md

Schema Extensions

get a schema extension details

GET https://graph.microsoft.com/v1.0/schemaExtensions?$filter=id eq '<extension_id>'

get a group

GET https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq 'tolle010'
View asp.net-core-react_azure-pipelines.yml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
View spo.ps1
#Connect Disconnect
#https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps
$adminUPN="admin@takana15.onmicrosoft.com";
$orgName="takana15";
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password.";
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential;
#oneliner:
Connect-SPOService -Url https://takana15-admin.sharepoint.com -Credential (Get-Credential -UserName spadmin@takana15.onmicrosoft.com -Message "psw")
Disconnect-SPOService
View disable-group-creation.ps1
#https://docs.microsoft.com/sv-se/office365/admin/create-groups/manage-creation-of-groups?view=o365-worldwide
Connect-AzureAD
$newSetting = Get-AzureADDirectorySetting | ? { $_.DisplayName -eq "Group.Unified" }
$settingsObjectID = $newSetting.id
$settingsCopy = Get-AzureADDirectorySetting -Id $settingsObjectID
$settingsCopy["EnableGroupCreation"] = $false
$creatorsGroup = Get-AzureADGroup -SearchString "Creators"
$settingsCopy["GroupCreationAllowedGroupId"] = $creatorsGroup.ObjectId
Set-AzureADDirectorySetting -Id $settingsObjectID -DirectorySetting $settingsCopy
View schema-extension.ps1
# https://docs.microsoft.com/en-us/powershell/azure/active-directory/using-extension-attributes-sample?view=azureadps-2.0
# @mirontoli
# A schema extension is always connected to an application
$dummyApp = New-AzureADApplication -DisplayName "My Properties Bag" -IdentifierUris "https://dummy"
$objectId = $dummyApp.ObjectId
New-AzureADServicePrincipal -AppId $dummyApp.AppId
New-AzureADApplicationExtensionProperty -ObjectId $dummyApp.ObjectId -Name "MyNewProperty" -DataType "String" -TargetObjects "User"
# e85def52-0f7b-44b7-a5fc-bfe72f909682 extension_9e715f8ddb8f4350a8b29b9e76561abc_MyNewProperty {User}
View group-naming-policy.ps1
# @mirontoli, 2019-04-01, run line by line, just a test. takana15
# https://docs.microsoft.com/sv-se/office365/admin/create-groups/groups-naming-policy?view=o365-worldwide
Install-Module AzureADPreview -Scope CurrentUser
Import-Module AzureADPreview
Connect-AzureAD
$template = Get-AzureADDirectorySettingTemplate | ? { $_.DisplayName -eq "Group.Unified" }
$settingsCopy = $template.CreateDirectorySetting()
New-AzureADDirectorySetting -DirectorySetting $settingsCopy
$newSetting = Get-AzureADDirectorySetting | ? { $_.DisplayName -eq "Group.Unified" }
$settingsObjectID = $newSetting.id
@mirontoli
mirontoli / user-aliases.cmd
Created Jun 5, 2018
My cmder user-alias additions
View user-aliases.cmd
repos=cd %HOME%/source/repos
View configure-wfm.ps1
# this script is generated by workflow manager configuration wizard
# I have extracted variables to parameters
# an alternative to this script can be found on
# Rob Garret's blog: https://blog.robgarrett.com/2014/05/12/install-workflow-manager-with-powershell/
# Author @mirontoli 2018-04-24
# an example of usage:
# .\configure-wfm.ps1 -dbServer SPWorkFlow -dbPrefix dev_ -spServiceAcctName contoso\wfm_service -spServiceAcctPWD "P@ssword" -passphrase "Blablabal"
param(
You can’t perform that action at this time.