delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/06/16:11:58

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=4.8 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,SARE_MSGID_LONG45,TBC,TW_BN
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <g2v8d4f2741005061304x1ed44d57i8b67f615e7ab9ead@mail.gmail.com>
References: <g2v8d4f2741005061304x1ed44d57i8b67f615e7ab9ead AT mail DOT gmail DOT com>
From: Jason Hamilton <jason DOT hamilton AT thefuzz4 DOT net>
Date: Thu, 6 May 2010 14:11:17 -0600
Message-ID: <m2z8d4f2741005061311qbd965147g39d2b8ec6425459f@mail.gmail.com>
Subject: Fwd: Remote restart of IIS App pool via ssh
To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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.=A0 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.=A0 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,=A0 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=92d 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 =3D "vidcbpm2002 "
Set objWMIService =3D GetObject _
=A0=A0=A0 ("winmgmts:{authenticationLevel=3DpktPrivacy}\\" _
=A0=A0=A0=A0=A0=A0=A0 & strComputer & "\root\microsoftiisv2")

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

For Each objItem in colItems
=A0=A0=A0 objItem.Stop
Next

Here is the output of env from the ssh session

ALLUSERSPROFILE=3DC:\Documents and Settings\All Users
ANT_HOME=3Dc:\apache-ant-1.6.1
CLUSTERLOG=3DC:\WINNT\Cluster\cluster.log
COMMONPROGRAMFILES=3DC:\Program Files\Common Files
COMPUTERNAME=3DVIDCBPM2001
COMSPEC=3DC:\WINNT\system32\cmd.exe
CVS_RSH=3D/bin/ssh
CYGWIN=3Dntsec smbntsec ntea tty
FP_NO_HOST_CHECK=3DNO
HOME=3D/home/gotscm
HOMEDRIVE=3DC:
HOMEPATH=3D\cygwin\home\gotscm
HOSTNAME=3DVIDCBPM2001
INFOPATH=3D/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/in=
fo:/usr/autotool/stable/info:
LOGNAME=3Dgotscm
LOGONSERVER=3D\\IDC1DC0004
MAIL=3D/var/spool/mail/gotscm
MAKE_MODE=3Dunix
MANPATH=3D/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man:
NUMBER_OF_PROCESSORS=3D1
OLDPWD=3D/home/gotscm
OS=3DWindows_NT
PATH=3D/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:/cy=
gdrive/c/WINNT/System32/Wbem:/cygdrive/c/nant/bin:/cygdrive/c/apache-ant-1.=
6.1/bin:/cygdrive/c/arapi.net:/usr/bin:/bin
PATHEXT=3D.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=3Dx86
PROCESSOR_IDENTIFIER=3Dx86 Family 16 Model 4 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=3D16
PROCESSOR_REVISION=3D0402
PROGRAMFILES=3DC:\Program Files
PS1=3D\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$
PWD=3D/cygdrive/e
SHELL=3D/bin/bash
SHLVL=3D1
SSH_CLIENT=3D10.1.160.153 44705 22
SSH_CONNECTION=3D10.1.160.153 44705 10.5.1.196 22
SSH_TTY=3D/dev/tty0
SYSTEMDRIVE=3DC:
SYSTEMROOT=3DC:\WINNT
TEMP=3D/cygdrive/c/DOCUME~1/SSHD_S~1/LOCALS~1/Temp
TERM=3Dvt100
TMP=3D/cygdrive/c/DOCUME~1/SSHD_S~1/LOCALS~1/Temp
TZ=3DMST7MDT6,M3.2.0/2,M11.1.0/2
USER=3Dgotscm
USERDOMAIN=3DLEVEL3
USERNAME=3Dgotscm
WINDIR=3DC:\WINNT
_=3D/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.=A0 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019