Powershell Script causing Access Export corruption?


so, i've been told maintainers of report use daily little script below causing data corrupted (i.e. first 20 rows of data, including headers, missing). possible?

$cpath = "<the path>"  $mpath = "<the destination>"  $timecheck = 1  while($timecheck -lt 90){  	$lastc = (get-itemproperty -path $cpath).lastwritetime  	$lastm = (get-itemproperty -path $mpath).lastwritetime  	if ($lastc -gt $lastm) {  		start-sleep -s 30  		copy-item $cpath -destination $mpath  				  		$a = new-object -comobject wscript.shell  		$b = $a.popup("files have been copied!",0,"files copied",1)  		  		$timecheck = 100  	}  	else {  	start-sleep -s 60  	$timecheck = $timecheck++  	}  }

have scheduler launch 5 minutes before file "expected" updated. i'm missing fundamental understanding, insight appreciated.

ok, decided re-write foreach method.

foreach($i in 1..90){ 	start-sleep -s 60     	c:\ps\copycc.ps1 }

where copycc.ps1 contains latswritetime checks , copy information. works (so far!). need try add copycc.ps1 code block foreach code block, can add snippet turn off foreach. :) i'll see how works , post findings.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file