Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The kit contains the following files:

FileDescription
charon_cleanshutdown.ps1
Powershell
PowerShell main script
charon_cleanshutdown_Windows.exp
Expect script, launched by the Powershell script if 'expect' is selected
rsh.exeUsed if 'rsh' mode is selected
template.iniUsed to facilitate the creation of a customized configuration file for the CHARON instance
psexec.exeDownloaded from Microsoft Sysinternals and used in case of integration to Windows shutdown

Shutdown command

Depending on the guest operating system running on the CHARON instance, the following commands are executed to perform a clean shutdown:

...

Tru64

uname -a

for all modes except 'expect' followed by:

init 0

OpenVMS

Depending on the method selected (described in more detail below), one of the following commands is executed:

Either

@SYS$SYSTEM:SHUTDOWN 0 SHUTDOWN NO YES LATER NO NONE

or the script detailed below if 'expect' is not used.

Requirements

Powershell V4.0 or newer is recommended. The execution of Powershell scripts must have been enabled.

/sbin/init 0

OpenVMS

@SYS$MANAGER:CHARON_SHUTDOWN.COM

Requirements

PowerShell V5.1 or newer version is required.

To run PowerShell scripts (files that end with .ps1), you must first set the execution policy to Unrestricted (This operation has to be done once).

To do so, open a command line window (cmd.exe) as an Administrator and use the following command:

c:\Charon>powershell -command "Set-ExecutionPolicy Unrestricted"

(info) The ExecutionPolicy can also be set to "RemoteSigned". In this case the .ps1 script files will have to be unblocked as described below.

If you are still prompted to allow for execution of the script, please run the following command to unblock the downloaded charon_cleanshutdown.ps1 file:

c:\Charon>powershell -command "Unblock-File -path c:\charon\charon_cleanshutdown.ps1"

(lightbulb) See PowerShell version, upgrade, enabling scripts execution, tips and tricks.

Div
classpagebreak


Available methods

Four methods are available to perform the remote shutdown. For all methods except 'expectopa0', the CHARON Charon host must be able to communicate via TCP/IP with the guest operating system(s) running on the CHARON instance(s).

...

Please select the method that is best suited to your configuration:

telnet

This mode requires the Windows telnet client to be installed. This can be done using the following command:

ModeDescriptionRequirementsNotes
opa0

Telnet to the guest operating system using credentials stored in an encrypted clixml file.

C:\Charon> pkgmgr /iu:"TelnetClient"
  • OpenVMS only, does not work with Tru64.
  • If the password of the guest operating system changes, the encrypted clixml file has to be updated.
expectSimulates an interactive connection to the console of the CHARON instance and performs the necessary actions.
Warning
titleRestrictions

Expect is supported only on Windows Server 2008 R2 and Windows 7. Windows Server 2012 R2, Windows Server 2016 and Windows 8.1 and 10 are not supported.

  • Download and install TCL from http://www.activestate.com/activetcl/expect. Select the "x86" version, not "x64" as 'expect' is not included in the "x64" kit. Do not install a package version higher than ActiveTcl8.6.4.1.299124-win32-ix86-threaded as the Expect kit could be missing. This kit can also be downloaded here.
    Open a command window (cmd.exe), go to c:\tcl\bin and run:

    C:\tcl\bin> teacup install Expect

    (warning) Case sensitive: 'Expect' must be entered as shown (not 'expect').
    .

  • Download plink.exe from the www.putty.org web site: click on the "You can download PuTTY here." link and copy plink.exe to the same folder (recommended) as the Powershell and Expect scripts (C:\Charon for example).Connection to the OPA0 console via telnet on the specified port using PowerShell internal functions

    The 'SYS$MANAGER:CHARON_SHUTDOWN.COM' script must exist on the emulated VMS system.

    No requirement if Tru64 is used.

    • Does not work if the console is running an application. Works only if the console is at the SRM prompt, prompting for username or password, or at the shell prompt.
    • Does not work if a connection to the console is already active from another host than the CHARON server.
    • If the password of the guest operating system changes, either the encrypted
    clixml
    • password file has to be updated or the password stored in clear text in the configuration file.
    • Useful if TCP/IP is not available on the guest operating system running on the CHARON instance.
    rsh

    Executes a remote command on the guest operating system (TCP/IP is required).

    On Tru64 the .rhosts file must be configured and on OpenVMS the rexec/rsh services must have been enabled and a proxy must have been created.

    The 'rsh.exe' file is included in the kit. Copy it to a folder of your choice ("C:\Bin" or "C:\Charon" for example).

    The Charon Windows server and the emulated operating system must be able to communicate via TCPIP.

    The 'SYS$MANAGER:CHARON_SHUTDOWN.COM' script must exist on the emulated VMS system.

    No requirement if Tru64 is used.

    • Not subject to password change.
    ssh

    Executes a remote command on the guest operating system over a secure connection (TCP/IP is required).

    Download and install OpenSSH from this site: the https://sourceforgegithub.netcom/projectsPowerShell/opensshwindows/.

    (info) The installation is menu driven, use the default options.

    • Not subject to password change.
    • Secure connection.

    ...

    Win32-OpenSSH/releases web site or preferably the version attached to this document. As a user with Administrator privileges, extract the package to C:\Program Files\OpenSSH.

    The Charon Windows server and the emulated operating system must be able to communicate via TCPIP.

    The 'SYS$MANAGER:CHARON_SHUTDOWN.COM' script

    ...

    must exist on the emulated VMS system.

    No requirement if Tru64 is used.

    • Not subject to password change.
    • Secure connection.


    Div
    classpagebreak


    OpenVMS shutdown script

    Copy/paste this script on your OpenVMS system, it will be used to issue the shutdown command for all modes except 'expect'"rsh", "ssh" and "opa0" modes:

    $ EDIT SYS$MANAGER:CHARON_SHUTDOWN.COM

    Code Block
    languagetext
    $ IF F$MODE() .eqs. "OTHER"

    
    $
    THEN
    $   DEFINE SYS$OUTPUT OPA0:
    $  
     THEN
    $   DEFINE SYS$OUTPUT OPA0:
    $   @SYS$SYSTEM:SHUTDOWN 0 SHUTDOWN NO YES LATER NO
    NONE
    $
    $ ELSE
    $   SET VERIFY
    $   PURGE
     NONE
    $
    $ ELSE
    $   IF "''P1'".EQS."CHECK"
    $   THEN
    $     WRITE SYS$OUTPUT "''P2' was successful"
    $   ELSE
    $     SET VERIFY
    $     PURGE /KEEP=20 SYS$MANAGER:CHARON_SHUTDOWN.LOG

    $   RUN
    
    $     RUN /DETACH SYS$SYSTEM:LOGINOUT.EXE /INPUT=SYS$MANAGER:CHARON_SHUTDOWN
    -
           
     -
              /OUTPUT=SYS$MANAGER:CHARON_SHUTDOWN.LOG /UIC=[1,4]

    $ ENDIF
    $
    
    $   ENDIF
    $ ENDIF
    $ EXIT


    Include Page
    KBCOMMON:KB-GoToTop
    KBCOMMON:KB-GoToTop