the problem i am having is the file is not getting created on the mapped drive, isee the output in the command window but no file gets created.

the
$nul= ReDirectOutput ("M:\Inventory\"+@WKSTA+".txt",1)
confuses me what do i need a var for. yes i am new to this so please be nice