couldn't easily find anything fresh about it so decided to post mine.
it has proven to work 100% so many times and is quite simple so lets push the logic.
the mover itself is quite simple:
Code:
;printer mover
;###########################
function printermove()
dim $,$printer,$new
for each $printer in split(left(readprofilestring(@ldrive+"control\printermove.ini","",""),-1),chr(10))
; ? "checking printer: " $printer
if primapstate($printer)
$new=readprofilestring(@ldrive+"control\printermove.ini",$printer,"newshare")
$=addprinterconnection($new)
; if @error mail("printermove failure","error occured while tried to connect to new printer share ("+$new+"): @serror") exit 0 endif
if 2=primapstate($printer)
$new=readprofilestring(@ldrive+"control\printermove.ini",$printer,"newname")
$=setdefaultprinter($new)
; if @error mail("printermove failure","error occured while tried to set new printer ("+$new+") as defaul: @serror") exit 0 endif
endif
$=delprinterconnection($printer)
; if @error mail("printermove failure","error occured while tried to disconnect from old printermap ("+$printer+"): @serror") exit 0 endif
; mail("printermove success","printermove of "+$printer+" to "+$new+" was carried out successfully.")
endif
next
endfunction
my version has two dependies, mail() which is just smtp-wrapper and primapstate() that is foundable on the board too.
if you don't need to get success mails, you can leave the mail lines commented out.
also, I have that first commented out line uncommented IRL as my logonscript runs windowless (with wkix32) and all console output is pushed to logon.log for later examination.
ini-file would look simple as:
Code:
[\\secondsrv\ibmMatrix]
newshare=\\theNewShinyStar\ibmMatrix1
newname=\\theNewShinyStar\the old ibm matrix
now, the section name is the old sharename that primapstate checks from the clients registry.
if the user has it mapped, it will be remapped to the new location.
if user had it default, the new share will be set to default.
then the old one gets deleted.
what comes to the logic...
I have also made script that maps drives (group drives and such) based on it.
just not using in production yet. iirc.