小编Alf*_*res的帖子

Powershell从Linux客户端连接到Windows远程

我正在尝试从Linux工作站远程连接到Windows机器.

我在Arch Linux工作站上安装了powershell,我正在尝试连接到主机.

在主持人:

Enable-PSRemoting

然后允许所有主机 Set-Item wsman:\localhost\client\trustedhosts *

检查一切:

PS C:\windows\system32> ls WSMan:\localhost\shell


   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Shell

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   AllowRemoteShellAccess                         true
System.String   IdleTimeout                                    7200000
System.String   MaxConcurrentUsers                             2147483647
System.String   MaxShellRunTime                                2147483647
System.String   MaxProcessesPerShell                           2147483647
System.String   MaxMemoryPerShellMB                            2147483647
System.String   MaxShellsPerUser                               2147483647
Run Code Online (Sandbox Code Playgroud)

现在当我尝试从Linux工作站连接时:

PS /home/user/tmp> Enter-PSSession -ComputerName "myuser" -Credential DOMAIN\myuser

Windows PowerShell credential request
Enter your credentials.
Password for user DOMAIN\myuser: *****************

Enter-PSSession : MI_RESULT_ACCESS_DENIED
At line:1 char:1
+ Enter-PSSession -ComputerName "myuser" -Credential DOMAIN\ajpalhare ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ …
Run Code Online (Sandbox Code Playgroud)

linux powershell remote-access windows-10

7
推荐指数
2
解决办法
8477
查看次数

Python CLIck,测试线程应用程序

我正在尝试使用 pytest 测试基于点击的线程应用程序。该应用程序将永远运行并等待键盘事件。

主要.py

#!/usr/bin/python

import threading
import time
import typing
import logging
import click


def test_func(sample_var:str):
    print("Sample is: " + sample_var)

@click.option("--sample", required=True, help="Sample String", default="sample", type=str)
@click.command()
def main(sample: str):

    print("Starting App r")
    interrupt = False
    while not interrupt:
        try:
            print("Start threading ..")    
            my_thread = threading.Thread(
                target=test_func,
                kwargs=dict(sample_var=sample),
                daemon=True)
            my_thread.start()
            my_thread.join(120)
            if not interrupt:
                print("Resting for 60 seconds")
                time.sleep(60)
        except(KeyboardInterrupt, SystemExit):
            print("Received Keyboard Interrupt or system exisying, cleaning all the threads")
            interrupt=True


if __name__ == "__main__":
    main(auto_envvar_prefix="MYAPP")
Run Code Online (Sandbox Code Playgroud)

问题是,在测试时我不知道如何发送 …

python pytest python-click

2
推荐指数
1
解决办法
567
查看次数