memory management - Powershell Script Consuming more ram on 2k12r2 than on 2k8r2 -


i migrating script below 2k8r2 server 2k12r2 server. runs fine on 2k8 box 2gb of ram. when run on 2k12 box, consumes on 8gb. tips or ideas on causing this?

import-module activedirectory  start-transcript -path ./bbbbxfer.log -append  $dn = "ldap://ldapserver/dc=bbbb,dc=pvt" $username = "uid=ldapuser,cn=service accounts,cn=config" $password = "ldappassword" $auth = [system.directoryservices.authenticationtypes]::none $de = new-object system.directoryservices.directoryentry($dn,$username,$password,$auth) $array = @() $header = 'bbbbcn' + "`t" $header += 'bbbbcompanyid' + "`t" $header += 'bbbbcompanyname' + "`t" $header += 'bbbbeffectivestartdate' + "`t" $header += 'bbbbempexemptstatus' + "`t" $header += 'bbbbemprehiredate' + "`t" $header += 'bbbbgivenname' + "`t" $header += 'bbbbinitials' + "`t" $header += 'bbbbleguserid' + "`t" $header += 'bbbbmail' + "`t" $header += 'bbbbmgrid' + "`t" $header += 'bbbbmanagername' + "`t" $header += 'bbbbposaccountingunit' + "`t" $header += 'bbbbposdaudescription' + "`t" $header += 'bbbbposdepartmentfunctionname' + "`t" $header += 'bbbbposdepartmentid' + "`t" $header += 'bbbbposdepartmentname' + "`t" $header += 'bbbbposemployeeid' + "`t" $header += 'bbbbposjobcode' + "`t" $header += 'bbbbposjobfamilydescriptor' + "`t" $header += 'bbbbposlocationdescription' + "`t" $header += 'bbbbposoneovermanagerid' + "`t" $header += 'bbbbposoneovermanagername' + "`t" $header += 'bbbbpospositiontitle' + "`t" $header += 'bbbbpostwoovermanagerid' + "`t" $header += 'bbbbpostwoovermanagername' + "`t" $header += 'bbbbprocesslevel' + "`t" $header += 'bbbbsn' + "`t" $header += 'bbbbstatus' + "`t" $header += 'bbbbeffectiveenddate' + "`t" $header += 'bbbbempemployeeid' + "`t" add-content bbbbdailyexport.txt $header      #$query = "(&(|(bbbbenterpriseid=e*)(bbbbenterpriseid=p*))(|(bbbbstatus=a)(bbbbstatus=l)(bbbbstatus=s)))"     #$query = "(|(bbbbenterpriseid=e*)(bbbbenterpriseid=p*))"     $query = "(|(bbbbenterpriseid=e*)(bbbbenterpriseid=p*)(bbbbenterpriseid=c*)(bbbbenterpriseid=a*))"     $ds = new-object system.directoryservices.directorysearcher($de,$query)     #$ds = new-object system.directoryservices.directorysearcher($de,"(bbbbenterpriseid=e30191)")     $ds.propertiestoload.add("bbbbcn") | out-null     $ds.propertiestoload.add("bbbbcompanyid") | out-null     $ds.propertiestoload.add("bbbbcompanyname") | out-null     $ds.propertiestoload.add("bbbbeffectivestartdate") | out-null     $ds.propertiestoload.add("bbbbempexemptstatus") | out-null     $ds.propertiestoload.add("bbbbemprehiredate") | out-null     $ds.propertiestoload.add("bbbbgivenname") | out-null     $ds.propertiestoload.add("bbbbinitials") | out-null     $ds.propertiestoload.add("bbbbleguserid") | out-null     $ds.propertiestoload.add("bbbbmail") | out-null     $ds.propertiestoload.add("bbbbmgrid") | out-null     $ds.propertiestoload.add("bbbbmanagername") | out-null     $ds.propertiestoload.add("bbbbposaccountingunit") | out-null     $ds.propertiestoload.add("bbbbposdaudescription") | out-null     $ds.propertiestoload.add("bbbbposdepartmentfunctionname") | out-null     $ds.propertiestoload.add("bbbbposdepartmentid") | out-null     $ds.propertiestoload.add("bbbbposdepartmentname") | out-null     $ds.propertiestoload.add("bbbbenterpriseid") | out-null     $ds.propertiestoload.add("bbbbposjobcode") | out-null     $ds.propertiestoload.add("bbbbposjobfamilydescriptor") | out-null     $ds.propertiestoload.add("bbbbposlocationdescription") | out-null     $ds.propertiestoload.add("bbbbposoneovermanagerid") | out-null     $ds.propertiestoload.add("bbbbposoneovermanagername") | out-null     $ds.propertiestoload.add("bbbbpospositiontitle") | out-null     $ds.propertiestoload.add("bbbbpostwoovermanagerid") | out-null     $ds.propertiestoload.add("bbbbpostwoovermanagername") | out-null     $ds.propertiestoload.add("bbbbprocesslevel") | out-null     $ds.propertiestoload.add("bbbbsn") | out-null     $ds.propertiestoload.add("bbbbstatus") | out-null     $ds.propertiestoload.add("bbbbeffectiveenddate") | out-null     $ds.propertiestoload.add("bbbbempemployeeid") | out-null     foreach($result in $ds.findall()){         $samaccountname = $result.getdirectoryentry().bbbbleguserid.tostring()          $bbbbstatus = $result.getdirectoryentry().bbbbstatus.tostring()         $name = $user.name         $export = new-object psobject         $line = ""         $line = $result.getdirectoryentry().bbbbcn.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbcompanyid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbcompanyname.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbeffectivestartdate.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbempexemptstatus.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbemprehiredate.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbgivenname.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbinitials.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbleguserid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbmail.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbmgrid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbmanagername.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposaccountingunit.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposdaudescription.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposdepartmentfunctionname.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposdepartmentid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposdepartmentname.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbenterpriseid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposjobcode.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposjobfamilydescriptor.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposlocationdescription.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposoneovermanagerid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbposoneovermanagername.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbpospositiontitle.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbpostwoovermanagerid.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbpostwoovermanagername.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbprocesslevel.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbsn.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbstatus.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbeffectiveenddate.tostring() + "`t"         $line += $result.getdirectoryentry().bbbbempemployeeid.tostring() + "`t"         add-content bbbbdailyexport.txt $line     } move-item bbbbdailyexport.txt "d:\scripts\bbbbexport\bbbbdailyexport-archivetemp\bbbbdailyexport$(get-date -f yyyymmdd).txt" #move-item bbbbdailyexport.txt "\\server\feed\bbbbdailyexport$(get-date -f yyyymmdd).txt"  stop-transcript 


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -