This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: Remote restart of IIS App pool via ssh


Ok so this is what I am trying to do.
Server 1 has cygwin installed and I can ssh into it using keys
My batch file on the server is working just fine for what I want it to do
Here is the problem.? I have a vbs script that needs to be ran at the
beginning and the end of the shell script to stop and start a remote
app pool.
Here is my script

All this does is stops the app pool on the second server, copies the
files over and then starts it back up.? Nothing special

#! /bin/bash

cmd.exe /c E:\stopapppoolenv1.vbs

xcopy /y /s /i "E:\WEBSITES\bpmportalenv1\webroot\*.*"
"\\bidcbpm2002.corp.global.level3.com\bpmportalenv1$"

cmd.exe /c E:\startapppoolenv1.vbs

exit 0

So when I run it,? it copies the files to the remote server just fine
but when it gets to the section about stopping and starting the app
pool on the remote server I get this

$ cmd.exe /c stopapppoolenv1.vbs
e:\stopapppoolenv1.vbs(2, 1) Microsoft VBScript runtime error:
Permission denied: 'GetObject'

when I log into the box as the user that I am ssh’d in as I can run
the vbs files just fine the user is a local admin on both boxes.

Just in case here is the vbs file

$ cat stopapppoolenv1.vbs
strComputer = "vidcbpm2002 "
Set objWMIService = GetObject _
??? ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
??????? & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
??? ("Select * From IIsApplicationPool Where Name = " & _
??????? "'W3SVC/AppPools/bpmportalenv1'")

For Each objItem in colItems
??? objItem.Stop
Next

Here is the output of env from the ssh session

ALLUSERSPROFILE=C:\Documents and Settings\All Users
ANT_HOME=c:\apache-ant-1.6.1
CLUSTERLOG=C:\WINNT\Cluster\cluster.log
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMPUTERNAME=VIDCBPM2001
COMSPEC=C:\WINNT\system32\cmd.exe
CVS_RSH=/bin/ssh
CYGWIN=ntsec smbntsec ntea tty
FP_NO_HOST_CHECK=NO
HOME=/home/gotscm
HOMEDRIVE=C:
HOMEPATH=\cygwin\home\gotscm
HOSTNAME=VIDCBPM2001
INFOPATH=/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/stable/info:
LOGNAME=gotscm
LOGONSERVER=\\IDC1DC0004
MAIL=/var/spool/mail/gotscm
MAKE_MODE=unix
MANPATH=/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man:
NUMBER_OF_PROCESSORS=1
OLDPWD=/home/gotscm
OS=Windows_NT
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/Orant9i
home/bin:/cygdrive/c/Program
Files/Oracle/jre/1.1.8/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem:/cygdrive/c/nant/bin:/cygdrive/c/apache-ant-1.6.1/bin:/cygdrive/c/arapi.net:/usr/bin:/bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 16 Model 4 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=16
PROCESSOR_REVISION=0402
PROGRAMFILES=C:\Program Files
PS1=\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$
PWD=/cygdrive/e
SHELL=/bin/bash
SHLVL=1
SSH_CLIENT=10.1.160.153 44705 22
SSH_CONNECTION=10.1.160.153 44705 10.5.1.196 22
SSH_TTY=/dev/tty0
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINNT
TEMP=/cygdrive/c/DOCUME~1/SSHD_S~1/LOCALS~1/Temp
TERM=vt100
TMP=/cygdrive/c/DOCUME~1/SSHD_S~1/LOCALS~1/Temp
TZ=MST7MDT6,M3.2.0/2,M11.1.0/2
USER=gotscm
USERDOMAIN=LEVEL3
USERNAME=gotscm
WINDIR=C:\WINNT
_=/usr/bin/env

Thank you all for your help in advance and if there is anymore
information you need for this please let me know and I will provide it
to you asap.? Thanks.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]