{"id":138,"date":"2005-09-22T14:28:33","date_gmt":"2005-09-22T18:28:33","guid":{"rendered":"\/?p=138"},"modified":"2005-09-24T07:42:06","modified_gmt":"2005-09-24T11:42:06","slug":"calling-vandyke-crt-in-a-microsoft-dts","status":"publish","type":"post","link":"https:\/\/toddsingleton.net\/chronicle\/2005\/09\/22\/calling-vandyke-crt-in-a-microsoft-dts\/","title":{"rendered":"Calling VanDyke CRT from a Microsoft DTS"},"content":{"rendered":"<p><a href=\"\/chronicle\/photos\/sauce.jpg\" class=\"imagelink\"><img decoding=\"async\" src=\"\/chronicle\/photos\/crt.gif\" align=left vspace=5 hspace=12 alt=\"CRT\"\/><\/a>One of the things I have always disliked about administering Windows servers and workstations is their inherent inability to act as a basic terminal.  You&#8217;ve got to use terminal emulation software to login to NFS based firmware and appliances.  Recently this became a huge issue when we were required to delete the contents of a volume on a NetApp SAN at Dillon Supply.  Here was the scenario:<\/p>\n<p>We have a volume <i>vol0\/dscsql2db<\/i> on a NetApp FAS270 filer.  Every night all of the NetApp &#8220;snapshots&#8221; on this volume need to be deleted.  The <i>snap delete<\/i> command native to the snapdrive service on Windows 2003 servers cannot perform the force deletion of an entire volume.  The <i>snap delete<\/i> command in the OS of the filer can delete the entire contents of a volume regardless of a snapshots state or condition.  More specifically, one of the snapshots we wanted to delete is mounted as a read\/writable volume on a server (busy, LUNs).  Therefore the arguments available in the <i>snap delete<\/i> command on the filer are required.<\/p>\n<p>So we needed a way to log on directly to the NetApp filer from within a Microsoft SQL DTS (Data Transformation Service) and execute the snap delete command to remove the entire contents of the volume.  Basically, I needed to run a Vbscript as a job executed by a DTS against the Netapp filer.  That&#8217;s where <a href=\"http:\/\/www.vandyke.com\/products\/index.html\">VanDyke CRT<\/a> came in.  I could have used custom expect scripts and spent a long time figuring out how to get them to run through Telnet.  Instead we set up a default Telnet session for the CRT application to use when called by the parent DTS (by IP Address) then it automatically executes the following login script:<\/p>\n<p><i>#$language = &#8220;VBScript&#8221;<br \/>\n#$interface = &#8220;1.0&#8221;<\/p>\n<p>Sub main<\/p>\n<p>  &#8216; turn on synchronous mode so we don&#8217;t miss any data<br \/>\n  crt.Screen.Synchronous = True<\/p>\n<p>  &#8216; Wait for a string that looks like &#8220;login: &#8221; or &#8220;Login: &#8221;<br \/>\n  crt.Screen.WaitForString &#8220;ogin: &#8221;<\/p>\n<p>  &#8216; Send your username followed by a carriage return<br \/>\n  crt.Screen.Send &#8220;root&#8221; &#038; vbCr<\/p>\n<p>  &#8216; Wait for a tring that looks like &#8220;password: &#8221; or &#8220;Password: &#8221;<br \/>\n  crt.Screen.WaitForString &#8220;assword:&#8221;<\/p>\n<p>  &#8216; Send your password followed by a carriage return<br \/>\n  crt.Screen.Send &#8220;ya, you wish&#8221; &#038; vbCr<\/p>\n<p>  crt.Screen.WaitForString &#8220;etapp1&#8221;<\/p>\n<p>&#8216; ++++ Begin Production commands to delete snapshots<\/p>\n<p> crt.Screen.Send &#8220;snap delete -a -f -q dscsql2db&#8221; &#038; vbCr<\/p>\n<p> crt.Screen.WaitForString &#8220;etapp1&#8221;<\/p>\n<p> crt.Screen.Send &#8220;snap delete -a -f -q dscsql2logs&#8221; &#038; vbCr<\/p>\n<p>&#8216; ++++ End Production commands to delete snapshots<\/p>\n<p>  &#8216; turn off synchronous mode to restore normal input processing<\/p>\n<p>  crt.Screen.Synchronous = False<\/p>\n<p>&#8216; This will wait 30 seconds<br \/>\ncrt.Sleep 30000<br \/>\n&#8216; dismiss the app<br \/>\ncrt.quit<\/p>\n<p>End Sub<\/i><\/p>\n<p>Notice the <i>crt.whatever.wait and .send<\/i> vb scripting objects.  It&#8217;s these objects included in CRT that made this all possible.  Once the script command executes to delete the contents of the volume on the NetApp filer, it closes CRT and our SQL DTS can proceed with creating a new snapshot of our production database volume, mounting this snapshot to a remote server where it is then attached to MS SQL as one of the last steps.  Bang! The refreshed reporting server is on-line.<\/p>\n<p>None of this would have been possible without our $35 copy of CRT.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the things I have always disliked about administering Windows servers and workstations is their inherent inability to act as a basic terminal. You&#8217;ve got to use terminal emulation software to login to NFS based firmware and appliances. Recently this became a huge issue when we were required to delete the contents of a &hellip; <a href=\"https:\/\/toddsingleton.net\/chronicle\/2005\/09\/22\/calling-vandyke-crt-in-a-microsoft-dts\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Calling VanDyke CRT from a Microsoft DTS<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-138","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/comments?post=138"}],"version-history":[{"count":0,"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/posts\/138\/revisions"}],"wp:attachment":[{"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/media?parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/categories?post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/toddsingleton.net\/chronicle\/wp-json\/wp\/v2\/tags?post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}