Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SN185201 opened this issue Jul 6, 2022 · 0 comments

Comments

@SN185201
Copy link

SN185201 commented Jul 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant