<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: scripting question in Server Management - Systems Insight Manager</title>
    <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305939#M61777</link>
    <description>Hello Seth&lt;BR /&gt;&lt;BR /&gt;I have had success by creating a custom command that launches my vb scripts when certain events come in.  My script does not recieve a list of servers from SIM but it does recieve all of the variables that are stored in an event.  SIM uses the variable DEVICENAME for the computername.  I incorporate this into my script like this:&lt;BR /&gt;&lt;BR /&gt;Set objShell = WScript.CreateObject("WScript.Shell")&lt;BR /&gt;strComputer = objShell.ExpandEnvironmentStrings("%DEVICENAME%")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
    <pubDate>Wed, 08 Dec 2004 13:48:16 GMT</pubDate>
    <dc:creator>Mark Kempe</dc:creator>
    <dc:date>2004-12-08T13:48:16Z</dc:date>
    <item>
      <title>scripting question</title>
      <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305935#M61773</link>
      <description>Well, I've been writing VBscripts that play with active directory and WMI for quite a while now, so I'm thinking it can't be all that hard to write one for SIM.  So far, though, I haven't been having much luck.&lt;BR /&gt;&lt;BR /&gt;I'm trying to write an ordinarily very simple script that will become a custom command to reboot a list of servers.  I want to do some late-night unassisted reboots.  It doesn't have to pull the list from the targets in SIM, it could read in a text file, but it would be nice to pull the list from SIM.&lt;BR /&gt;&lt;BR /&gt;Here's the basic functionality of the code:&lt;BR /&gt;DO&lt;BR /&gt;    Set CompConn = GetObject("winmgmts:{(RemoteShutdown)}//" &amp;amp; targetcomp &amp;amp; "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")&lt;BR /&gt;&lt;BR /&gt;    FOR EACH OS IN CompConn&lt;BR /&gt;        OS.reboot()&lt;BR /&gt;    NEXT&lt;BR /&gt;LOOP WHILE(boxes.atendofstream = false)&lt;BR /&gt;&lt;BR /&gt;Can anyone give me some guidance as to how I might mod this simple function to run as a useful SIM custom command?&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;Seth</description>
      <pubDate>Tue, 15 Jun 2004 14:41:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305935#M61773</guid>
      <dc:creator>Seth Kelly</dc:creator>
      <dc:date>2004-06-15T14:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305936#M61774</link>
      <description>Let me make that code a bit more intuitive, I didn't clean it up completely before posting it...&lt;BR /&gt;&lt;BR /&gt;FOR EACH box IN somecomputerlist&lt;BR /&gt;Set CompConn = GetObject("winmgmts:{(RemoteShutdown)}//" &amp;amp; targetcomp &amp;amp; "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")&lt;BR /&gt;&lt;BR /&gt;FOR EACH OS IN CompConn&lt;BR /&gt;OS.reboot()&lt;BR /&gt;NEXT&lt;BR /&gt;NEXT</description>
      <pubDate>Tue, 15 Jun 2004 14:44:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305936#M61774</guid>
      <dc:creator>Seth Kelly</dc:creator>
      <dc:date>2004-06-15T14:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305937#M61775</link>
      <description>Seth,&lt;BR /&gt;&lt;BR /&gt;I am attaching a script that will provide the functionality of reading through a list of computers and either reboot, logoff, or shut them down.&lt;BR /&gt;&lt;BR /&gt;Now for the integration into SIM we might see if one of the HP guys that monitor this newsgroup might have some ideas.&lt;BR /&gt;&lt;BR /&gt;Tim&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2004 08:00:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305937#M61775</guid>
      <dc:creator>Tim McGue</dc:creator>
      <dc:date>2004-06-16T08:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305938#M61776</link>
      <description>Thanks Tim.  I appreciate the script.  I do have scripts of my own that are relatively equivalent though.  My main issue comes with making it convenient and useful to others.  I'm just a summer intern, so much of the coding I do is focused on ease of use and long-term functionality for the real employees in my group who are less talented in coding.&lt;BR /&gt;&lt;BR /&gt;My hope is that I can make this reboot server script work just like the identify systems tool in SIM, for example.  To do that I need to understand how SIM interacts with my script.&lt;BR /&gt;&lt;BR /&gt;If I run a custom command on server1, server2, and server3, how do I access that list of target servers in the script that the command executes?  How do I report the results back to SIM?  When I run the command on a list of servers, does it run the script locally on each server, or does it just execute in the location that I drop the script on my CMS?  Basically, I'd like to know what the heck happens when I run a custom command and how I can harness those happenings.  So far my experimentation hasn't been getting me anywhere.&lt;BR /&gt;&lt;BR /&gt;If anyone has a script that is integrated similarly, that would probably be a less time-consuming alternative to explaining the inner workings of SIM to me.  I realize this is a rather complex question, and very much appreciate any assistance.&lt;BR /&gt;Seth</description>
      <pubDate>Wed, 16 Jun 2004 08:45:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305938#M61776</guid>
      <dc:creator>Seth Kelly</dc:creator>
      <dc:date>2004-06-16T08:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305939#M61777</link>
      <description>Hello Seth&lt;BR /&gt;&lt;BR /&gt;I have had success by creating a custom command that launches my vb scripts when certain events come in.  My script does not recieve a list of servers from SIM but it does recieve all of the variables that are stored in an event.  SIM uses the variable DEVICENAME for the computername.  I incorporate this into my script like this:&lt;BR /&gt;&lt;BR /&gt;Set objShell = WScript.CreateObject("WScript.Shell")&lt;BR /&gt;strComputer = objShell.ExpandEnvironmentStrings("%DEVICENAME%")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Wed, 08 Dec 2004 13:48:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305939#M61777</guid>
      <dc:creator>Mark Kempe</dc:creator>
      <dc:date>2004-12-08T13:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305940#M61778</link>
      <description>Bumped to be above moved questions...</description>
      <pubDate>Thu, 02 Feb 2006 15:48:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-systems/scripting-question/m-p/3305940#M61778</guid>
      <dc:creator>David Claypool</dc:creator>
      <dc:date>2006-02-02T15:48:06Z</dc:date>
    </item>
  </channel>
</rss>

