简体   繁体   English

Powershell查询WIN-> LINUX

[英]Powershell query WIN->LINUX

This is my first post in StackOverflow. 这是我在StackOverflow中的第一篇文章。 Here goes my question: 这是我的问题:

Two servers: 两台服务器:

Linux-FileServer, having different shares, open port 445 (NO ACCESS VIA SSH) 具有不同共享的Linux-FileServer,打开端口445(不通过SSH访问)

Windows-I can access the linux server from a mmc console, view all shares, share permissions, ntfs permissions. Windows-I可以从mmc控制台访问linux服务器,查看所有共享,共享权限,ntfs权限。

What I want to do is to get all share permissions (not ntfs) from each share allocated in the linux machine. 我要做的是从Linux机器中分配的每个共享中获取所有共享权限(而不是ntfs)。

I want to do that using powershell, I've seen solutions by usign WMI but I can't query linux using WMI. 我想使用Powershell做到这一点,我已经看过usign WMI的解决方案,但是我无法使用WMI查询linux。

Does anyone knows how I could do that using Powershell? 有谁知道我如何使用Powershell做到这一点? MMC console on windows can access that information so I think that what I want to do is possible. Windows上的MMC控制台可以访问该信息,因此我认为我想做的事情是可能的。

Thank you! 谢谢!

Mount a network path as a temporary drive and then being able to browse it using the shell. 将网络路径安装为临时驱动器,然后能够使用外壳对其进行浏览。

Use this command to mount the network path \\server\\share to P: 使用此命令将网络路径\\ server \\ share挂载到P:

New-PSDrive -Name P -PSProvider FileSystem -Root \\server\share

YOu can use net use or Wscript.Network for it: 您可以使用网络使用或Wscript.Network:

$net = new-object -ComObject WScript.Network
$net.MapNetworkDrive("u:", "\\server\share", $false, "domain\user", "password")

Note: I am not sure how you are entering to that server without ssh or something. 注意:我不确定没有ssh或其他东西如何进入该服务器。 If you have the access via UNC then you can simply map it or use it like I have mentioned. 如果您可以通过UNC访问,则可以简单地映射它或像我提到的那样使用它。 Else please use Posh-SSH module(if you have ssh access) which will help you to access. 否则,请使用Posh-SSH模块(如果您具有ssh访问权限),该模块将帮助您进行访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM