Hi all,
i was wondering if it is possible to do an automatic user creation by powershell, when a users loggs in for the first time.
Im having a demo environment which i refresh regular.
So can i when a user loggs in for the first time create a schedule script that makes the user "super"in nav automatically. So i dont have to add the user by hand?
It looks like MS does is also on its azure machines.
I have tried a bit with this:
--
Import-Module "${env:ProgramFiles}\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1"
# Add User
New-NavServerUser -WindowsAccount 'domain\user' -ServerInstance InstanceName
# Add Permission to the user
New-NavServerUserPermissionSet -WindowsAccount 'domain\user' -ServerInstance InstanceName -PermissionSetId SUPER
or maybe something like this,
# Add a NavUserPassword User who is SUPER
$user = Get-NAVServerUser $serverInstance | % { if ($_.UserName -eq $NavAdminUser) { $_ } }
if (!$user) {
New-NAVServerUser $serverInstance -UserName $NavAdminUser -Password (ConvertTo-SecureString -String $NavAdminPassword -AsPlainText -Force) -ChangePasswordAtNextLogOn:$false -LicenseType Full
New-NAVServerUserPermissionSet $serverInstance -UserName $NavAdminUser -PermissionSetId "SUPER"
But username, instance and also Computer name is constantly changing.
im running to several errors.Maybe someone could help?
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
thanks, im gonna try it!
oh no, i havent installed nav in a domain so im having only a local user.
Maybe the best i will delete all users and wont add them in nav.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.