- SMS Admins Group
- SMS Reporting Users Group
- SMS Remote Control Users Group:
- SMS Site Servers Group:
- SMS SQL Monitor Group
John Lan's Notes
Things I learn in the field of IdM
Search This Blog
Mar 4, 2024
temp
Feb 28, 2024
AzureAD module for Graph Notes
- How to install AzureAD module without internet connection
- Download nupkg file from PowerShell Gallery
- for module that has dependences, you can download all nupkg files into same folder
- copy nupkg file to a dedicated folder
- Assuming you have NuGet available, run "Register-PSRepository -Name <pickAName4YourRepository> -SourceLocation <absolute path to nupkg file>"
- You can now "find-module -repository <repositoryName>"
- "Install-Module -Name <moduleName>"
- placeholder
- Install modules behind company proxy
- run below as admin
- [System.Net.WebRequest]::DefaultWebProxy.Credentials = Get-Credential
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- ODATA filter syntax
- Get-AzureADUser -Filter "proxyAddresses/any(c:c eq 'smtp:user@domain.com')"
- Get-AzureADUser -Filter "Department eq 'HP'"
- Get-AzureADDirectoryROle -filter "DisplayName eq 'application administrator'"
- Find reference on Oasis website
- placeholder
- Connect to graph behind proxy
# [NOTE] Set up proxy. Below works for PS 5
[System.Net.WebRequest]::DefaultWebProxy.Credentials = Get-Credential
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Powershell 7 is using [System.Net.HttpWebRequest]::DefaultWebProxy instead of [System.Net.WebRequest]
[System.Net.HttpWebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy($null)
# this may work in companies where it can authenticate automatically
[System.Net.HttpWebRequest]::DefaultWebProxy.Credentials = Get-Credential
# Prompt for credential in companies that needs authN to use proxy
[System.Net.HttpWebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
# this can be used when proxy uses your default credential (it could be your domain credential, it could be your Azure cendenital, depending on your environment)
- placeholder
Jan 31, 2024
[PowerShell] When ExpandProperty is not good enough
The ExpandProperty parameter in select-object cmdlet is useful to view full values of a compound property (e.g. when a property's value is an array or an object). However the limitation is also obvious. It accepts only one property, so we are forced to write a script block to process all results, using a different way to convert/expand properties one by one, before we can finally assembly the output.
The other way to do it is to use inline expression. See below
$targetedProperties=@(samaccountname,@{l='membership'; e={$_.memberof}}@{l='allEmailAddresses'; e={$_.proxyAddresses}})$uObj = get-aduser 'johnDoe' -properties *$expandedObj = $uObj | select $targetedProperties
Array that includes most meaningful AD attributes for admins