PowerShell Script to modify session attributes in user objects

I have a script I have written to modify the '-TsMaxDisconnectionTime' to 15 minutes against a list of users in a csv file. the script runs without any incidents or errors. At the end of my time line and no longer have the time to research... any help would be greatly appreciated...

Import-Module ActiveDirectory

Add-PSSnapin Quest.ActiveRoles.ADManagement

$users = import-csv C:tempgisuserscfw.csv | ForEach-Object {Get-QADUser -SamAccountName $_.SamAccountName}
{
Set-QADUser -Identity $User -TsMaxDisconnectionTime "00:15"
}



So what is the question? You said it runs with no errors?



So what is the question? You said it runs with no errors?



Sorry... it runs with no errors but dosent make the change... when I run it per user it correctly changes the attribute to 15 minutes... it has something to do with the way I am calling the csv file...



This will work. You just have to make sure your CSV file has a Column Header named SamAccountName



I do have the header named 'SamAccountName' here is the error it returns... I also insured that I do have the actual username aka SamAccountName in the csv file.


Set-QADUser : Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))
At line:3 char:64
+ $Users = Import-Csv C:tempgisuserscfw.csv | ForEach-Object { Set-QADUser -Iden ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-QADUser], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.SetUserCmdlet



Share this

Related Posts

There was an error in this gadget