Skip to main content

Posts

Showing posts from December, 2008

removing lines from repadmin output with powershell

i challenged a coworker to put his powershell class to good use and come up with a script that would actually have an impact, albeit little, to his day-to-day administrative work. he came up with a little script that would dump repadmin output to a text file and mail him an attachment. here’s the script: %{repadmin /replsum * /bysrc /bydest} > logfile.txt $filename = “logfile.txt” $smtpServer = “mysmtp.mydomain.com” $msg = new-object Net.Mail.MailMessage $attachment = new-object Net.Mail.Attachment($filename) $smtp = new-object Net.Mail.SmtpClient($smtpServer) $msg.From = “myemail@mydomain.com” $msg.To.Add(”myemail@mydomain.com”) $msg.Subject = “Repadmin Report ” + [System.DateTime]::Now $msg.Body = “The daily Repadmin log file is attached” $msg.Attachments.Add($attachment) $smtp.Send($msg) this is okay, but opening that attachment every time would be irritating… so i thought it might be easier just to get the output into a variable and write it to the body of the email dire…

using powershell to replace “find” or “findstr”

this is one of those things i’m blogging to remind myself instead of bugging hal rottenberg. :)in order to find something inside a list of files, you can use find or findstr. what’s the difference between those? findstr is a bit more robust, accepting pattern matches with regex, for example. in most cases though, i’m just looking for a string inside of a list of text files. so here we go with find and the general output we can expect…C:\temp>find /i "wscript.echo" *.* ---------- DATE2INTEGER8.VBS ' wscript.Echo CurrentDate(Now)' WScript.Echo CurrentDate(dDateThreshold) WScript.Echo oRecordSet.Fields("cn") & ":" & oRecordSet.Fields("displayname") & ":" & Integer8Date(oRecordSet.Fields("pwdlastset").Value,lBias) ---------- DLNAMES.TXT ---------- DNS_DEBUG.LOG ---------- TEMP_SCRIPT.SM WScript.Echo WScript.Echo "==========================================" WScript.Echo "…

discovery data manager fails while processing a ddr

seems like a good day to blog about sms.  this happened with sms 2003.  yes, i realize there’s a configmgr.  very soon, i’ll be using it!  :)  for the rest of the unfortunate few, here’s the background:i received this error in mom today.  this is one of those indicators that should immediately tell you that a great day is about to ensue.mySMSServer - SMS 2003 Perf Threshold: Site Server DDR Backlog > 10,000 over 3 hours. SMS Discovery Data Manager: Total DDRs Enqueued: value = 8700. The average over last 12 samples is 5280.83.
that’s just bad.  further investigation showed that the server failed to process ddrs since 11/28/08.  i checked around to see if anything changed, but there wasn’t anything unusual.  so … off to the status messages.  here’s what i found:Microsoft SQL Server reported SQL message 242, severity 16: [22007][242][Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
now …

using preloadpkgonsite.exe to stage compressed copies to child site distribution points

UPDATE:john marcum sent me a kind email to let me know about a problem he ran into with preloadpkgonsite.exe in the new SCCM Toolkit V2 where under certain conditions, packages will not uncompress.  if you are using the v2 toolkit, PLEASE read this blog post before proceeding.here’s a scenario that came up on the mssms@lists.myitforum.com mailing list. when confronted with a situation of large packages and wan links, it’s generally best to get the data to the other location without going over the wire. in this case, 75gb. :/the “how” you get the files there is really not the most important thing to worry about. once they’re there and moved to the appropriate location, preloadpkgonsite.exe is required to install the compressed source files. once done, a status message goes back to the parent server which should stop the upstream server from copying the package source files over the wan to the child site.anyway, if it’s a relatively small amount of packages, you can run the execution li…