Just talk
Hello Friends,
It has been a while that I have posted the blogs, so planning to start again with lots of my experience which I gained in Enterprise IT.
Request:-
Since, most of the companies are moving to Azure cloud or any public clouds, here I got request from client to convert the "objectguid" to "Immutable ID" because, they wanted to maintain the "ms-ds-consistency guid" for the Sync accounts in Azure.
Solution:
So, lets power up the Powershell and before that lets also prepare the input file required for the script.
The input file should have "objectguid" for the provided users.
Script
#
Convert objectguid to Immutable ID: -
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
Param (
$Inputfile= ".\userlist.csv"
)
$list = Import-csv $Inputfile
"Name,SamaccountName,Mail,Objectguid,ImmutableID" | Out-File output.csv
foreach ($i in $list){
$guid = [GUID]$i.objectguid
$bytearray = $guid.tobytearray()
$immutableID = [system.convert]::ToBase64String($bytearray)
$immutableID
$nam= $i.name
$sam=$i.samaccountname
$obj=$i.objectguid
$mail=$i.mail
"$nam,$sam,$mail,$obj,$immutableID" | Out-File -Append output.csv
}
##########################
Input file format example
objectguid
kdfk232-23kl2323-kklkjk32-kkjklj32
###########################
No comments:
Post a Comment