Sponsored Content
Top Forums UNIX for Advanced & Expert Users Running Powershell Script from Linux through Cygwin Post 303020721 by shekhar_4_u on Thursday 26th of July 2018 07:30:47 AM
Old 07-26-2018
Running Powershell Script from Linux through Cygwin

Hello Experts,

I am creating a run time powershell script on Linux machine and copying that powershell script to Windows machine. To connect to windows through "ssh", I am using Cygwin tool. To make the connection password less I copied my public in authorized_keys in windows Administrator account and now I am able to login without password like below and able to run some powershell script like echoing "Hello world" and running some Windows command from Linux machine
.
HTML Code:
ssh Administrator@windowsServer
But, when I call any script that needs elavated access(tha's what I observed, I may be wrong also" it gives me error.


odshekhar@LinuxMachine:/tmp$ ssh odshekhar@Windowsmachine 'powershell -executionpolicy bypass -File "C:\scripts\abc.ps1"'


If I delete my public key from windows machine and perform the same operation from Linux machine(that is if i don't use password less connection), It asks me my password for Windows machine and it works.


So, in short, it does not work when I try to use passowrd less connection and works if I dont use passowrd less connection.

Please note it is not a permission issue or any issue to establish a connection to make a connection because I am able to run simple script making password-less connection and able to run many commands too.

Thanks in advance! Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Running a.out on Cygwin

I wrote and compiled a program on a unix machine using g++. Now I copied it over to the machine with the Unix emulator Cygwin. I tried to run it by entering "a.out" in the command prompt but was given: "bash: a.out: command not found" (without the quotes) Also worth mentioning is that i... (5 Replies)
Discussion started by: hito
5 Replies

2. Shell Programming and Scripting

Running shell script in Cygwin terminal

I am new to shell scripting. I tried to run a simple shell script using Cygwin terminal in Win XP env. The script I have written is as follows - #!/bin/bash a=5 ] && echo "true" || echo "false" But when I execute the script, getting some confusing error. The error I am getting are - ... (3 Replies)
Discussion started by: linux_learner
3 Replies

3. Windows & DOS: Issues & Discussions

Powershell Script Help

Need some help getting this script to work. can someone help. I am trying to create a script that moves log files to another location and only keeps 60 days worth. please see script I started but having issue getting to work.. $TODAY=GET-DATE GET-CHILDITEM C:\test\*.LOG | Where {... (9 Replies)
Discussion started by: freedavis
9 Replies

4. Shell Programming and Scripting

How to start powershell with shebang from windows/cygwin/bash?

I would like to the the windws8/cygwin/bash shebang feature to start a powershell script. I do a "chmod +x set-sound.ps1" and then at a bash prompt I do ./set-sound.ps1 The first line of ./set-sound.ps1 #!powershell.exe -ExecutionPolicy unrestricted The result is the result: ... (5 Replies)
Discussion started by: siegfried
5 Replies

5. Shell Programming and Scripting

Running q-shell commands( on IBM-i Series) from cygwin terminal (on windows)

I have cygwin installed on windows server and when I do echo $SHELL the output is /bin/bash I have created a ssh tunnel from this windows server through cygwin to ibm -i series which is running Q-shell. I am trying to invoke a utility wsadmin (used for scripting) on ibm-i from the... (12 Replies)
Discussion started by: gaurav99
12 Replies

6. Shell Programming and Scripting

Bash script - cygwin (powershell?) pull from GitHub API Parse JSON

All, Have a weird issue where i need to generate a report from GitHub monthly detailing user accounts and the last time they logged in. I'm using a windows box to do this (work issued) and would like to know if anyone has any experience scripting for GitAPI using windows / cygwin / powershell?... (9 Replies)
Discussion started by: ChocoTaco
9 Replies

7. Programming

Running python script in cygwin

I have python installed here on windows: C:\Python27 and can run a script from the command line but would rather use cygwin. $ cd "C:\Users\cmccabe\Desktop\annovar" cmccabe@DTV-L2231M5J /cygdrive/c/Users/cmccabe/Desktop/annovar $ python run_batch_job.py Traceback (most recent call last):... (3 Replies)
Discussion started by: cmccabe
3 Replies

8. Shell Programming and Scripting

Powershell script to monitor windows process

Hello Friend, I am not expert in power shell scripting. I nee custom powershell script which check if given process is running on windows machine or not. will use it in nagios to monitor that process. (0 Replies)
Discussion started by: ghpradeep
0 Replies

9. Shell Programming and Scripting

Execute powershell script with UNIX

Hi I have a powershell script which is checking whether a windows service is running (as shown below) function FuncCheckService { $ServiceName = 'pgsql-9.2' $arrService = Get-Service -Name $ServiceName if ($arrService.Status -eq 'Running') { Write-Output... (8 Replies)
Discussion started by: simpsa27
8 Replies

10. UNIX for Beginners Questions & Answers

powershell script to unix shell script conversion.

Here is a powershell script to use restful API to create ticket in our ticketing tool. Can anyone please convert it to a shell script sothat, I can run it in Unix servers, below is the code: $body = @{ Customer= ''test' Summary= 'test summary' Impact= '4-Minor/Localized' ... (2 Replies)
Discussion started by: pandeybhavesh18
2 Replies
asadmin-delete-connection-group(1AS)				   User Commands			      asadmin-delete-connection-group(1AS)

NAME
delete-connection--group - deletes the connection group SYNOPSIS
delete-connection-group --user user_name --password password --host hostname --port admin_port_number --instance instance_name --httplistener http_listener_ID connection_group_ID Deletes the connection group for the named connection group ID associated with the named server instance.. OPTIONS
--user identifies the user name associated with the named instance. --password identifies the password associated with the user name. --host identifies the host name for the machine. --port identifies the administrator port number associated with the hostname. --instance identifies the name of the instance associated with the JVM option to be created. --httplistener a unique identifier for the HTTP listener. connection_group_ID a unique identifier for the connection group. asadmin% delete-connection-group INTERFACE EQUIVALENT
unknown asadmin-create-connection-group(1AS) asadmin-list-connection-groups(1AS) J2EE 1.4 SDK March 2004 asadmin-delete-connection-group(1AS)
All times are GMT -4. The time now is 01:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy