Import-AXModule "AxUtilLib" $false $true
Import-AXModule "AxUtilLib.PowerShell" $true $false
Import-AXModule "Microsoft.Dynamics.Administration" $false $false
Import-AXModule "Microsoft.Dynamics.AX.Framework.Management" $false $false
$AXUsers = Get-AXUser | where {$_.AXUserId -and $_.UserName}
$AXUserId = $null
$Users = "eshant.k","Manikanta.m"
foreach($user in $users)
{
if ($user.length -gt 8)
{
$AXUserId = ($user.SubString(0,7) + $user.substring($user.length -1))
Write-Verbose "Altered AXUserId from $($user) to $AXUserId in order to fit length requirements."
}
else
{
$AXUserId = $user
}
New-AXUser -AccountType WindowsUser -AXUserId $AXUserId -username $user -UserDomain diplit.local
Add-AXSecurityRoleMember -AxUserID $AXUserId -AOTName "-SYSADMIN-"
}
Import-AXModule "AxUtilLib.PowerShell" $true $false
Import-AXModule "Microsoft.Dynamics.Administration" $false $false
Import-AXModule "Microsoft.Dynamics.AX.Framework.Management" $false $false
$AXUsers = Get-AXUser | where {$_.AXUserId -and $_.UserName}
$AXUserId = $null
$Users = "eshant.k","Manikanta.m"
foreach($user in $users)
{
if ($user.length -gt 8)
{
$AXUserId = ($user.SubString(0,7) + $user.substring($user.length -1))
Write-Verbose "Altered AXUserId from $($user) to $AXUserId in order to fit length requirements."
}
else
{
$AXUserId = $user
}
New-AXUser -AccountType WindowsUser -AXUserId $AXUserId -username $user -UserDomain diplit.local
Add-AXSecurityRoleMember -AxUserID $AXUserId -AOTName "-SYSADMIN-"
}
No comments:
Post a Comment