Change you $ShellCMD from
quote:
"m:\winnt\tscmd.exe dc1nwbgh datalan terminalserverprofilepath"
to
quote:
"%comspec% /c dir c:\"
Does the same error occur? If you hit an account without a TS profile your program may be bring back an unexpected value or aborting.

I think once you get past this error you will find another with "? $text" since $text should be an array. You will have to use a "for each" loop.

[ 10. October 2003, 03:54: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/