Jump to content

Recommended Posts

Posted

we are going to open teminal service to staff through Frog but to a limited number of PC's and want to set the End a disconnected session time i have a quest Powershell command that works if I type it in to the Powershell script window but dose not work if I put it in to a PS1 file the following is the script command that works

 

import-csv C:\ps1scripts\Sessions.csv | ForEach-Object {Get-QADUser -Name $_.Name |Set-QADUser -TsMaxDisconnectionTime '00.01.00'}

 

it take a scv file and rins the getQADUser command to get the user then the set command to set the Endadisconnected session time to 1 min how ever the command dose not work form a PS1 file it returns the following error

 

Set-QADUser : Cannot bind parameter 'TsMaxDisconnectionTime'. Cannot convert value "00.01.00" to type "System.TimeSpan"

. Error: "Input string was not in a correct format."

At C:\ps1scripts\sessions.ps1:1 char:105

+ import-csv Sessions.csv | ForEach-Object {Get-QADUser -Name $_.Name |Set-QADUser -TsMaxDisconnectionTime <<<< '00.01

.00'}

 

for each user

itis going to be somthing simple i am missing but can any one see why

Posted

Does this work?

 

Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
Import-CSV C:\ps1scripts\Sessions.csv | ForEach-Object { Get-QADUser -Name $_.Name | Set-QADUser -TsMaxDisconnectionTime '00.01.00' }

Posted

unfortunately no it give the same error

 

but you caused me to look again and i found the error thank you '00.01.00' needs to be '00:01:00'

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...