AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-589685

Usman's questions

Martin Hope
Usman
Asked: 2020-09-27 01:28:01 +0800 CST

为什么在远程打开文件时Get-SmbOpenFile会丢失锁定

  • 1

我正在使用 Get-SmbOpenFile,但令人惊讶的是,它失去了连接,我可以看到即使在文件上几秒钟后也没有锁定,即使它仍然处于打开状态。我可以安全地删除我服务器上的那个文件。

为什么,这可以吗?我必须检查与用户连接的打开的 .VHDX 磁盘文件,如果它们仍然打开,则需要关闭它们。

Get-SmbOpenFile | Where-Object { $._Path -match '\\apvdp100\Profile\TestP1088\100.txt' } returns nothing even the file is opened remotely.

Get-SmbOpenFile | Where-Object { $._Path -match '100.txt' } returns the object if i open the file remotely and check within a second or so and stops outputting after few tries. Sometimes, even immediately issueing `Get-SmbOpenFile` doesn't outputs anything at all.

所以,我有两个问题:-)

那么,搜索文件的正确方法是什么?(以上完全限定路径不返回搜索结果)

为什么几秒钟后锁会丢失

windows powershell powershell-v5.0 powershell-v3.0 powershell-v4.0
  • 1 个回答
  • 350 Views
Martin Hope
Usman
Asked: 2020-08-29 05:15:42 +0800 CST

如何从本地使用 powershell 连接到远程服务器。Enter-PSSession 不工作(不相关的 Exchange 服务)

  • -1

我正在尝试使用本地 powershell 会话连接到远程计算机。

为此,我尝试使用本地 powershell Enter-PSSession 或 New-PSSession 命令作为:

$session = New-PSSession -ConnectionUri 'http://testserverUri.dom/PowerShell'

但是我总是在异常之后得到。

New-PSSession : [testserveruri.dom] Connecting to remote server apdv0710.forest7.dom failed with the following
error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was
not available. This is usually returned by a HTTP server that does not support the WS-Management protocol. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $session = New-PSSession -ConnectionUri 'http://testserverUri.dom/ ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed

我还使用了其他变体:

    Enter-PSSession -Authentication Kerberos -ConnectionUri 'http://testserveruri.dom/PowerShell' -Cred $credential
    Enter-PSSession : Connecting to remote server apdv0710.forest7.dom failed with the following error message : The WinRM
    client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available. This is
    usually returned by a HTTP server that does not support the WS-Management protocol. For more information, see the
    about_Remote_Troubleshooting Help topic.
    At line:1 char:12
    + $session = Enter-PSSession -Authentication Kerberos -ConnectionUri 'h ...
    +            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (http://testserveruri.dom/PowerShell:Uri) [Enter-PSSession], PSRemot
       ingTransportException
        + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

在大多数情况下,我得到了第一个例外。

当我使用 C# 打开运行空间并为 WSManConnectionInfo 对象提供远程服务器 powerSell url 时,也会发生同样的异常。

我已经对 winrm 命令进行了各种处理,但这并不能真正解决问题。如何摆脱这个问题?

powershell remoting winrm ps
  • 2 个回答
  • 1540 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve