
내 virtaul 시스템에 PS 스크립트를 설치했습니다. 내 VM은 도메인 계정에 연결되어 있으며 하나의 서비스 계정이 제공됩니다. 지금 내 스크립트는 수동으로 실행되고 있습니다. 하지만 스크립트를 설정한 시간을 기다리고 있으면 작동하지 않습니다. 저는 Windows Server 2016을 사용하고 있습니다.
파워 쉘 스크립트
$path = "C:\Users\svaccount\Desktop\STAT1\"
$fileName = "STAT1_"
$date = Get-Date -Format MMddyyyhhmmss
$file = $path + $filename +
$date + ".jpeg"
Add-Type -AssemblyName System.Windows.Forms
Add-type -AssemblyName System.Drawing
# Gather Screen resolution information
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Width = $Screen.Width
$Height = $Screen.Height
$Left = $Screen.Left
$Top = $Screen.Top
# Create bitmap using the top-left and bottom-right bounds
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
# Create Graphics object
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
# Capture screen
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
# Save to file
$bitmap.Save($File)
작업의 내 구성.
일반 탭 -보안 옵션 .account 사용자: (서비스 계정) .사용자가 로그온한 경우에만 실행을 선택합니다. .가장 높은 권한으로 실행을 선택했습니다. .구성: Windows Server 2016 트리거 탭 작업 시작: 일정에 따라 설정: 매일, 1일마다 반복 고급 설정: 선택됨 작업 반복 간격: 1년 동안 5분 활성화가 선택되었습니다. 액션 탭 조치: 프로그램 시작 설정: .프로그램/스크립트: powershell.exe .인수 추가(선택 사항): -windowstyle 숨김 "C:\POGI.ps1" 조건 탭 .이 작업을 실행하려면 컴퓨터 깨우기를 선택했습니다. 설정 탭 .필요 시 작업 실행 허용을 선택했습니다.
내 스크립트를 디버깅하는 줄을 찾았습니다. 이것이 도움이 되는지 모르겠습니다.
**********************
Windows PowerShell transcript start
Start time: 20181129151208
Username: OSISOFT\svaccount
RunAs User: OSISOFT\svaccount
Machine: PI-WBS (Microsoft Windows NT 10.0.14393.0)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Process ID: 19732
PSVersion: 5.1.14393.206
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14393.206
BuildVersion: 10.0.14393.206
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is c:\temp\debug.log
**********************
Windows PowerShell transcript end
End time: 20181129151209
**********************
이에 대한 귀하의 도움에 감사드립니다.
감사해요!