我写了以下 .ps1 文件:-
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request = [System.Net.WebRequest]::Create("https://localhost/")
$response = $request.GetResponse()
$response.Close()
Run Code Online (Sandbox Code Playgroud)
我在 windows server 2012 r2 任务调度程序中设置了一个任务,在 ps1 文件上方调用 te。现在我手动运行这个任务,但它一直显示“0x41301”,这意味着它仍在运行......虽然如果我直接运行PowerShell 窗口中的上述代码将在不到一秒的时间内结束?那么为什么使用任务 Schuler 调用这个 ps1 永远不会结束?
--编辑--这里是导出的XML:-
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2016-02-09T00:35:11.5514762</Date>
<Author>ad-services\user.service</Author>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<Repetition>
<Interval>PT5M</Interval>
<Duration>PT30M</Duration>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2016-02-09T19:30:01</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-20</UserId>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings> …
Run Code Online (Sandbox Code Playgroud) 我的 Windows 7 中有 vmware 9.0,但我的 Windows 7 突然因错误而关闭,然后又重新启动。但是当我启动我的虚拟机时,我收到以下错误:-
Failed to lock the file
Cannot open the disk 'C:\Users\XXXX Dev.vmdk' or one of the snapshot disks it depends on.
Run Code Online (Sandbox Code Playgroud)
任何人都可以建议是什么导致了这个问题以及我如何解决这个问题?多谢?