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. PHP操作MongoDB数据库具体样例介绍(增、删、改、查) (六)

    PHP操作mongodb: PHP 要操作mongodb须要打模块 官网能够下载:http://pecl.php.net/package/mongo 下载 mongodb设置成用户授权的启动方式 ph ...

  2. unity, UGUI Text outline

    UGUI Text的勾边效果是通过添加component实现的: Add Component->UI->Effects->Outline 参考:http://www.cnblogs. ...

  3. NGUI中获取鼠标在控件内部坐标

    在UIWidget 中添加以下函数.获得的坐标系是以右上角为原点坐标,x轴向左,一轴向下. public Vector2 GetTouchPoint() { Vector3 p0 =  cachedT ...

  4. SQL server账号无法登陆

  5. TLS线程局部存储

    0x01 TLS (Thread Local Storage) 为线程单独提供的私有空间 0x02 gcc中的隐式TLS使用方法 隐式TLS __thread int number; 显式TLS pt ...

  6. springmvc配置AOP的两种方式

    spingmvc配置AOP有两种方式,一种是利用注解的方式配置,另一种是XML配置实现. 应用注解的方式配置: 先在maven中引入AOP用到的依赖 <dependency> <gr ...

  7. Oracle之函数concat、lpad

    一.引言 程序测试需要生成大量的测试数据,且测试数据有主键,主键自增,于是决定用存储过程来实现,经过半天的查资料终于完成了,记录之,学习之 二.存储过程 格式: CREATE PROCEDURE re ...

  8. php中Http请求方法和响应状态码整理教程

    HTTP请求报文由请求行(request line).请求头部(header).空行和请求数据4个部分组成,格式如下 可见请求行由请求方法字段.URL字段和HTTP协议版本字段3个字段组成,它们用空格 ...

  9. sublimtext3 自定义编译环境

    sublime text是一个非常神奇到编辑器,对于我这种小白来说,感觉比vim好用,但是如果用sublime自带到编译环境到话,是没法向程序汇总输入数据的,所以要自己新建编译命令 { "c ...

  10. hbase java Api练习

    package cn.itcast_01_hbase; import java.util.ArrayList; import java.util.List; import org.apache.had ...