Hi All,
I am in the process of creating a dashboard that runs a script to create a new user.
The script will clear any existing sessions, set the session value to 0 and then create a new session. When the user creation task occurs and once the account has been completed, the session is disconnected and removed.
So that a session remains active whilst in use and doesn’t get disconnected when a new session is executed, how can i perform a check to see if a session exists and if it does create a new one with the next ID value.
e.g. admin A opens sessions and starts creating a new user
admin B logs on straight after on a different machine and starts to create a new user also
i would like each admin to have their own session without closing each others session.
here is an example of my script:``
$session = $null
If($session -eq $null){
$session = 0
}
Else {$session++}
Disconnect-PSSession $session
Remove-PSSession $session
Will this suffice? Am I going about this the right way?
Thanks for your feedback.
Angelo