문제

하고 싶은 윈도우 2003 서버 화재 스크립트를 화재 또 다른 스크립트에서 별도의 윈도우 서버 2008 컴퓨터입니다.

나왔다는 것을 말 Powershell 할 수있는 좋지만,필요한 자세한 정보는.

누군가에 대해 어떠한 조언을 이?

감사합니다!

도움이 되었습니까?

해결책

독자 여러분이 생각하 에서 SysInternals

다른 팁

으로 보는 구문에 명령입니다.당신은 그것을 사용할 수 있습을 예약하려면 프로세스를 실행하에서 원격 컴퓨터입니다.

AT 명령을 일정 명령 프로그램을 실행하는 컴퓨터에서 지정된 시간과 날짜입니다.일정 서비스를 실행하고 있어야 합니다 사용하기 AT 명령입니다.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername     Specifies a remote computer. Commands are scheduled on the
                   local computer if this parameter is omitted.
id                 Is an identification number assigned to a scheduled
                   command.
/delete            Cancels a scheduled command. If id is omitted, all the
                   scheduled commands on the computer are canceled.
/yes               Used with cancel all jobs command when no further
                   confirmation is desired.
time               Specifies the time when command is to run.
/interactive       Allows the job to interact with the desktop of the user
                   who is logged on at the time the job runs.
/every:date[,...]  Runs the command on each specified day(s) of the week or
                   month. If date is omitted, the current day of the month
                   is assumed.
/next:date[,...]   Runs the specified command on the next occurrence of the
                   day (for example, next Thursday).  If date is omitted, the
                   current day of the month is assumed.
"command"          Is the Windows NT command, or batch program to be run.

가장 쉬운 방법이 사용될 것이 두 가지 단계

니다.설치 cygwin 원격 pc

b.실행 ssh 허드슨@mcs'/cygdrive/c/path_to_script.bat'

에 대해 말하기 PsExec, 것 나 강력 을 사용하는 것이 좋 Cygwin/OpenSSH 대신 합니다.

SSH 은 여러 이점(연구 PsExec 또는 맞춤 서비스).
예를 들어,다음과 같이 실행한다면 사용 PsExec 하고 구현하이 무엇 이 bash / ssh 명령 라인을 수행:

ssh user@remotehost "find . -name something" 2> all.errors.txt
ssh user@remotehost "grep -r something ."
if [ "$?" == "0" ]
then
    echo "FOUND"
else
    echo "NOT FOUND"
fi

행운을 빕니다!

  • SSH 교통편(!) 원격 stdout/stderr/출 상태 쉘에 대한 검사
    (킬러 기능과 일반적인 요구 사항을 통합하는 원격 실행은 논리로 현지 스크립트)

  • Cygwin/OpenSSH 제공 POSIX 쉘 환경
    (효율적으로 시간을 투자,근본적인 공구,크로스-플랫폼을 준비 호환 거주,등.)

  • 할 수 있도/항상 실행 모든 native Windows 응용 프로그램
    (를 포함하여 자동으로 실행하기 *.bat 여 파일 cmd 프로세서)

  • 구성할 수 있습니다 암호 인증을 사용하여 공개 열쇠
    (고 생각에 대한 무인 자동화된 작업)


가 있었다 하나의 요구 사항 문제가 있었음:
배경 sshd 서비스를 실행하는 앱에서는 사용자의 그래픽 세션
(프로그램을 만들기 위해 창에 표시 데스크탑 환경).

허용 가능한 솔루션 나를 위해 실행 sshd 서비스 바로 에서 사용자 세션의 GUI
(시작할 때 자동으로 사용자가 로그에서 링크를 클릭하십시오 구성을 참조하십시오 파일 변화):

/usr/sbin/sshd -f /home/user/sshd_config

허용에서 솔루션 http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Q_22959948.html 입니다:

내가 무엇을 제공했는 스크립트 매개 변수...이 경우에는 그 4.1)서버전달하는 경우-서버 만 하시는 하나의 서버 2)목록:당신 을 제공할 수 있는 목록은 파일 서버입니다.3)서비스:의 이름이 서비스 수정하려고 4)자세한 정보:지 여기에서 사용됩니다.

나는 몇 가지 실수를 나 에서 변경 다음 코드입니다.사 복사/붙여넣기 코드로 라는 파일 정-RemoteService.ps1.을 확인하십시 을 설정하려면 실행 스크립트는...지 않을 것이 기본적으로 합니다.당신 지를 사용하여 려면합니다.PS> 려면"다."하기 스크립트를 실행 할 PS> C:\PathToScript\Set-RemoteService.ps1 목록 c:\ServerList.txt 서비스"DHCP"

######################### Param($server,$목록,$서비스,[스위치]$자세한 정보)

if($자세한 정보){$VerbosePreference= "계속"}if($목록){ foreach($srv 에는(-콘텐츠$list)) { $query="Select*from Win32_Service 는 이름='$서비스'" $myService=get-WmiObject-query$쿼리를 컴퓨터$srv $myService.ChangeStartMode("Automatic") $myService.Start() }}if($server){ $query="Select*from Win32_Service 는 이름='$서비스'" $myService=get-WmiObject-query$쿼리를 컴퓨터$서버 $myService.ChangeStartMode("Automatic") $myService.Start()}

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top