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. jsp自己主动编译机制

    总的来说,Jasper的自己主动检測实现的机制比較简单,依靠某后台线程不断检測JSP文件与编译后的class文件的最后改动时间是否同样,若同样则觉得没有改动.但倘若不同则须要又一次编译.实际上因为在T ...

  2. word2vector 理解入门

    1.什么是word2vector? 我们先来看一个问题,假如有一个句子 " the dog bark at the mailman". 假如用向量来表示每个单词,我们最先想到的是用 ...

  3. Docker 私有仓库最简便的搭建方法

    http://blog.csdn.net/wangtaoking1/article/details/44180901/ Docker学习笔记 — Docker私有仓库搭建http://www.jian ...

  4. vb.net winform exe 接参数

    找到如下文件 -\WindowsApplication1\My Project\Application.Designer.vb <Global.System.Diagnostics.Debugg ...

  5. 通过 SysVinit、Systemd 和 Upstart 管理系统自启动进程和服务

    管理 Linux 自启动进程 Linux 系统的启动程序包括多个阶段,每个阶段由一个不同的图示块表示.下面的图示简要总结了启动过程以及所有包括的主要组件. Linux 启动过程 当你按下你机器上的电源 ...

  6. 3.2 Zend_Db_Select

    10.4. Zend_Db_Select 你能够使用该对象和它的对应方法构建一个select查询语句,然后生成 字符串符用来传送给zend_db_adapter进行查询或者读取结果. 你也能够在你的查 ...

  7. hdu Distant Galaxy(遥远的银河)

    Distant Galaxy Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  8. [android] 本地推送服务

    遇到新需求:游戏要添加本地的推送功能,ios比较好搞,在应用退出时的系统回调中设置,android就稍稍麻烦一点,需要用到 android中的service,和receiver

  9. word中特殊符号的替换

    首先在word里替换快捷键是ctrl+H,点击“更多”,会出现更多选项,在特殊格式那里可以选在各种符号,比如回车,空格什么的. 有的时候在word里看不到一些格式,需要点一下下图的对着的两个箭头图标: ...

  10. linux学习笔记11---命令more

    more命令,功能类似 cat ,cat命令是整个文件的内容从上到下显示在屏幕上. more会以一页一页的显示方便使用者逐页阅读,而最基本的指令就是按空白键(space)就往下一页显示,按 b 键就会 ...