MarketSquare / MarketSquare/SSHLibrary

Unable to execute a Power-shell script (via batch script) when we use "Execute Command" of SSHLibrary from host machine.

Open
#420 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
167
Forks
145
PR merge metrics
No merged PRs in 30d

Description

We are trying to create a restore point on remote machine (windows). We could see the batch script is executed but not the power shell script which is indirectly called inside batch script.

So we suspect the issue can be while running a script which in turn calls another script.

Please note when we manually execute the batch script, it successfully executes powershell script as well.
The issue occurs when we try to run the batch script using SSHLibrary Execute/Start command.

**Host machine (robot file):**
Create Windows Restore Point
Open Connection 129.xxx.xxx.xxx timeout=1 hour
Login xxxx xxxx
Execute Command D:\\CreateWindowsRestorePoint.bat

**Remote machine (bat file)**
echo Started
cd "%~dp0"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""D:\CreateWindowsRestorePoint.ps1""' -Verb RunAs}"
echo Ended

**Remote machine (ps1 file)**
Enable-ComputerRestore -Drive "C:\"
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /V "SystemRestorePointCreationFrequency" /T REG_DWORD /D 0 /F
Checkpoint-Computer -Description "Restorepoint1"
Get-ComputerRestorePoint

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Robot Framework Execute Command call for D:\CreateWindowsRestorePoint.bat and compare it with manual execution on the Windows host. Inspect the batch file's invocation of D:\CreateWindowsRestorePoint.ps1 and SSHLibrary's remote command execution; done means the PowerShell script runs through the batch file and creates the restore point.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, python
Domain
cli, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.