Checking password reset agent operation on a Windows Server VM
Checking that the agent is installed
-
Make sure the agent is installed and running as the
yc-guest-agentservice:PowerShellGet-Service "yc-guest-agent"-
If installed and running, the agent will be listed as
Running:Status Name DisplayName ------ ---- ----------- Running yc-guest-agent yc-guest-agent -
If installed but not running, the agent will be listed as
Stopped. To run the agent, use this command:Start-Service "yc-guest-agent"After that, check if the agent is now running.
-
If the agent is not installed, it will not appear in the list. Use this guide to install it.
-
Checking for agent updates
-
Make sure the agent updater is configured and running properly:
PowerShell-
Make sure the agent update job is running:
Get-ScheduledTask "yc-guest-agent-updater" -OutVariable TaskResult:
TaskPath TaskName State -------- -------- ----- \ yc-guest-agent-updater ReadyThe
yc-guest-agent-updaterjob must have theReadystatus. -
Get information about the most recent job run.
$Task | Get-ScheduledTaskInfoResult:
LastRunTime : 3/15/2023 2:39:39 PM LastTaskResult : 2147946720 NextRunTime : 3/20/2023 6:36:36 AM 12:10:10 AM NumberOfMissedRuns : 0 TaskName : yc-guest-agent-updater TaskPath : \ PSComputerName :If the most recent update was successful, you will see
0in theLastTaskResultfield.
-
Getting agent logs
You can get password reset agent logs on serial port 4 (COM4) or directly from the agent in PowerShell.
To get logs:
- Select the folder the VM belongs to.
- Select Compute Cloud.
- Click the line with the VM in question.
- Go to the Serial port tab.
- Select COM4 as your port.
- To use the CTRL + F shortcut to search, enable Raw mode in the top-right corner.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
Run the following command:
yc compute instance get-serial-port-output <VM_name> --port 4 > output.txt
The logs will be saved to a file named output.txt.
-
Stop the agent:
Stop-Service "yc-guest-agent" -
Restart the agent with the required logging level as specified in the
--log-levelparameter. Here is an example:& "C:\Program Files\Yandex.Cloud\Guest Agent\guest-agent.exe" start --log-level debug
To get the serial port output, use the getSerialPortOutput REST API method for the Instance resource or the InstanceService/GetSerialPortOutput gRPC API call. Set port to 4.