Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: ssh part updated

Anchor
TOC
TOC
Include Page
KBCOMMON:KB-CSSstyle
KBCOMMON:KB-CSSstyle

Note

UNDER CONSTRUCTION - Restricted view / Confluence admins

Contents

Table of Contents
excludeContents
stylesquare

Principle

Using the "Local Group Policy editorEditor", it is possible to add the execution of a powershell Powershell script at Windows shutdown. As this operation is performed with the "system" account, some operations have to be performed if the chosen mode is "rsh" or "ssh".

(info) There is no specific operation to perform if "expect" mode is selected.

rsh mode preparation

Warning

A proxy has to be defined at OpenVMS level hence the local "system" user must be specified. This user is translated depending on the language of the Windows distribution.

It is then highly recommended to install a English version of Windows to avoid issues with accents and non standard characters when creating this proxy.

...

Note

It is recommended to move the psexec.exe program file to a secured folder or to remove it when it is no more needed (check completed)

ssh mode preparation

→ use "psexec.exe -i -s cmd.exe" to run as local "system" account to create the ssh trust (keys)

→ test with "Execute the same operations as described in chapter "Using ssh" for Tru64 or VMS to create a key pair with "SYSTEM" user.

To do so, use the psexec.exe program file provided in the kit or download it from the Microsoft Sysinternals page.

Open a cmd.exe window as Administrator and run the following command:

C:\WINDOWS\system32>C:\Charon\psexec.exe -i -s cmd.exe

...

A new window will popup. To check you're connected as "system", run:

C:\WINDOWS\system32>whoami

nt authority\system

The run the Powershell script in check mode:

C:\WINDOWS\system32>powershell -file c:\charon\charon_cleanshutdown.ps1 -config c:\charon\myds20vms.ini -check

then check the "SSH was successful" message is displayed followed by "Command successfully completed."

Note

It is recommended to move the psexec.exe program file to a secured folder or to remove it when it is no more needed (check completed)

Windows settings - Local group policy

Adding the script to the shutdown Powershell scripts

Open the "Local Group Policy Editor" (run gpedit.msc) and go to the Shutdown script setup:

...

Select the "Powershell Scripts" tab, click on the "Add..." button, specify the path to the charon_cleanshutdown.ps1 script and its parameters:

Display instructions in shutdown scripts as they run

It is recommended to enable the display instructions during shutdown to check the Charon Legacy OS shutdown is correctly performed.

...

Enable this functionality and optionally leave a comment:

Specify maximum wait time for Group Policy scripts

By default the script executed at Windows shutdown have a default timeout of 10 minutes (600 seconds). It is possible to change this value in case the shutdown takes more time.

...