This is the code I am trying to run in a script all by itself. There is no other code on the page and I replace $computername with a real machine name on my network I have full access to.
Code:
$drives[0]
$Dsks = GetObject("winmgmts://rlg012kd").ExecQuery("select * from Win32_DiskDrive")
if @error
"Error occured: " @error " " @serror ? "Press the anyKey to quit" get $key quit
endif
for each $Item in $Dsks
;dim again preserving the data that is in the array.
;redim with upper bound (the element amount) of array added by one.
redim preserve $drives[ubound($drives)+1]
$drives[ubound($drives)]= $Item.Size ;place the data to the last element
next
I get the error unexpected command! and its complaining abot the line thats starts with $Dsks = . If I comment out the first line the error goes away but then I wouldn't get the array either. Any ideas?