File System Rights

Get-Acl $sharepath | select -expand access | where { !$_.IsInherited -AND $_.filesystemrights -eq 'fullcontrol'}
 Get-Acl $sharepath | select -expand access | where {($_.identityreference -eq "everyone") -and ($_.InheritanceFlags -ne "None")}
$Result=@()
foreach($ComputerName in (Get-Content E:\fileserverlist.txt))
{
$Shareinfo=Get-WmiObject -ComputerName $computerName -Class win32_share | where { $_.type -eq 0 }
$Shareinfo | %{
$sharepath="\\" + $_.pscomputername + "\" +$_.Name
$acls = Get-Acl $sharepath | select -expand access | where { !$_.IsInherited -AND $_.filesystemrights -eq 'fullcontrol'}
foreach ($acl in $acls)
{$user=$acl.identityreference
$username=$user -replace '^.*\\'
$right=$acl.filesystemrights
if($user -like 'Domain*')
{
$userinfo=get-aduser -identity $username -Properties department,enabled
$dep=$userinfo.department
$name=$userinfo.name
$userstatus=$userinfo.enabled
}
else
{
$dep='no'
$name=$username
}
$info=New-Object Psobject
$info |Add-Member -MemberType NoteProperty -Name Name -Value $user
$info |Add-Member -MemberType NoteProperty -Name Name -Value $name
$info |Add-Member -MemberType NoteProperty -Name status -Value $userstatus
$info |Add-Member -MemberType NoteProperty -Name dept-Value $dep
$info |Add-Member -MemberType NoteProperty -Name ritht -Value $right
$info |Add-Member -MemberType NoteProperty -Name path -Value $sharepath
$Result+=$info
}
}
}
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('yyyy-MM-dd')
$Result |Export-Csv D:\ps\filerightinfo_$CurrentDate.csv -Encoding UTF8 -NoTypeInformation
 
获取Share Folder
Get-WmiObject -ComputerName $computerName -Class win32_share | where { $_.type -eq 0 }
$Result=@()
#将结果G赋值E给一@个空A数组
foreach($ComputerName in (Get-Content E:\IP.txt))
{
$Pingy = Get-WmiObject Win32_PingStatus -f "Address='$ComputerName'"
#循¦`环ping txt文a档中?的ocomputername
if($Pingy.StatusCode -eq 0)
{
$errorcount=$error.count
$Shareinfo=Get-WmiObject -ComputerName $computerName -Class win32_share | where { $_.type -eq 0 }
#如p果Gping得Óo通q,A获取Luservice
if($Shareinfo)
{
$Shareinfo | %{
$Resultinfo=New-Object PSobject
$Resultinfo |Add-Member -MemberType NoteProperty -Name ipaddress -Value $ComputerName
$Resultinfo |Add-Member -MemberType NoteProperty -Name Computername -Value $_.pscomputername
$Resultinfo |Add-Member -MemberType NoteProperty -Name ShareName -Value $("\\" + $_.pscomputername + "\" +$_.Name)
$Result+=$Resultinfo
}
}
else{
if($errorcount -eq $error.Count)
{
$Resultinfo=New-Object PSobject
$Resultinfo |Add-Member -MemberType NoteProperty -Name ipaddress -Value $ComputerName
$Resultinfo |Add-Member -MemberType NoteProperty -Name Computername -Value $Shareinfo.pscomputername
$Resultinfo |Add-Member -MemberType NoteProperty -Name ShareName -Value "No Share"
$Result+=$Resultinfo
}
else
{
$Resultinfo=New-Object PSobject
$Resultinfo |Add-Member -MemberType NoteProperty -Name ipaddress -Value $ComputerName
$Resultinfo |Add-Member -MemberType NoteProperty -Name Computername -Value $Shareinfo.pscomputername
$Resultinfo |Add-Member -MemberType NoteProperty -Name ShareName -Value "RPC error"
$Result+=$Resultinfo
}
}
}
else
{
$Resultinfo=New-Object PSobject
$Resultinfo |Add-Member -MemberType NoteProperty -Name ipaddress -Value $ComputerName
$Resultinfo |Add-Member -MemberType NoteProperty -Name Computername -Value $Shareinfo.pscomputername
$Resultinfo |Add-Member -MemberType NoteProperty -Name ShareName -Value "The Computer is Unaviable"
$Result+=$Resultinfo
}
}
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('yyyy-MM-dd')
$Result |Export-Csv D:\PS\Shareinfo_$CurrentDate.csv -Encoding UTF8 -NoTypeInformation

Powershell About File System的更多相关文章

  1. 解决adb push时出现的"Read-only file system"问题

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  2. Design and Implementation of the Sun Network File System

    Introduction The network file system(NFS) is a client/service application that provides shared file ...

  3. 乌版图 read-only file system

    今天在启动虚拟机的时候,运行命令svn up的时候,提示lock,并且read-only file system,这个....我是小白啊,怎么办?前辈在专心写代码,不好打扰,果断找度娘啊 于是乎,折腾 ...

  4. File system needs to be upgraded. You have version null and I want version 7

    安装hbase时候报错: File system needs to be upgraded. You have version null and I want version 7 注: 我安装的hba ...

  5. Linux系统启动错误 contains a file system with errors, check forced解决方法

    /dev/sda1 contains a file system with errors, check forced./dev/sda1: Inodes that were part of a cor ...

  6. Linux 执行partprobe命令时遇到Unable to open /dev/sr0 read-write (Read-only file system)

    在使用fdisk创建分区时,我们会使用partprobe命令可以使kernel重新读取分区信息,从而避免重启系统,但是有时候会遇到下面错误信息"Warning: Unable to open ...

  7. 磁盘、分区及Linux文件系统 [Disk, Partition, Linux File System]

    1.磁盘基础知识 1.1 物理结构 硬盘的物理结构一般由磁头与碟片.电动机.主控芯片与排线等部件组成:当主电动机带动碟片旋转时,副电动机带动一组(磁头)到相对应的碟片上并确定读取正面还是反面的碟面,磁 ...

  8. Linux File System

    目录 . Linux文件系统简介 . 通用文件模型 . VFS相关数据结构 . 处理VFS对象 . 标准函数 1. Linux文件系统简介 Linux系统由数以万计的文件组成,其数据存储在硬盘或者其他 ...

  9. ORA-00245: control file backup failed; target is likely on a local file system

    ORACLE11G RAC alert报错如下:Errors in file /u01/app/oracle/diag/rdbms/dljyzs/dljyzs1/trace/dljyzs1_ora_8 ...

随机推荐

  1. python \uxxxx转中文,Python列表中的字典 \uxxxx转中文,

    import json a = [{u', u'roleFlag': 7}] print json.dumps(a).decode("unicode_escape") 输出结果是: ...

  2. atitit。全局变量的设计与实现 java php的异同

    atitit.全局变量的设计与实现 java php的异同 1. 超级全局(Superglobals)"变量 1 2. 全局变量和"global"关键字 1 3. 更加好 ...

  3. thread_线程创建

    创建线程的2种方式,一种是直接继承Thread,另外一种就是实现Runnable接口. 这2种方式都有一个缺陷就是:在执行完任务之后无法获取执行结果.如果需要获取执行结果,就必须通过共享变量或者使用线 ...

  4. 去掉IntelliJ IDEA代码编辑区域的竖线

    (网络配图) 作为从事编程或者测试工作的人来说,尤其是有强迫症的,看着非常痛苦,我们来看看怎么去掉 在 Settings-> Editor-> General-> Appearanc ...

  5. [JNA系列]Java调用Delphi编写的Dll之JNA使用

    介绍 给大家介绍一个最新的访问本机代码的 Java 框架 —JNA . JNA(Java Native Access) 框架是一个开源的 Java 框架,是 SUN 公司主导开发的,建立在经典的 JN ...

  6. hMailServer之允许用户自己修改密码

    使用hMailServer搭建邮件系统,使用webmail实现web收发邮件,但是又个问题是在webmail中用户自己无法修改密码. 可以使用hMailServer自带的PhpWebAdmin来实现让 ...

  7. 【网络爬虫】Httpclient4.X中使用HTTPS的方法采集12306网站

    HttpClient请求https的实例: package train; import java.io.IOException; import java.security.NoSuchAlgorith ...

  8. extjs增删改查(自己调用extjs)

    jsp页面如下:materialsDetail.jsp <%@ page language="java" import="java.util.*" pag ...

  9. SOCK_RAW编程

    TCP(SOCK_STREAM)和UDP套接口(SOCK_DGRAM)可以满足大部分需求,但要获取底层协议内容就需要原始套接字.相比前两者,SOCK_RAW具有如下优点: 1)使用原始套接字可以读写I ...

  10. 线程同步工具CountDownLatch

    CountDownLatch的一个非常典型的应用场景是:有一个任务想要往下执行,但必须要等到其他的任务执行完毕后才可以继续往下执行.假如我们这个想要继续往下执行的任务调用一个CountDownLatc ...