Powershell About File System
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的更多相关文章
- 解决adb push时出现的"Read-only file system"问题
欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...
- Design and Implementation of the Sun Network File System
Introduction The network file system(NFS) is a client/service application that provides shared file ...
- 乌版图 read-only file system
今天在启动虚拟机的时候,运行命令svn up的时候,提示lock,并且read-only file system,这个....我是小白啊,怎么办?前辈在专心写代码,不好打扰,果断找度娘啊 于是乎,折腾 ...
- 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 ...
- 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 ...
- Linux 执行partprobe命令时遇到Unable to open /dev/sr0 read-write (Read-only file system)
在使用fdisk创建分区时,我们会使用partprobe命令可以使kernel重新读取分区信息,从而避免重启系统,但是有时候会遇到下面错误信息"Warning: Unable to open ...
- 磁盘、分区及Linux文件系统 [Disk, Partition, Linux File System]
1.磁盘基础知识 1.1 物理结构 硬盘的物理结构一般由磁头与碟片.电动机.主控芯片与排线等部件组成:当主电动机带动碟片旋转时,副电动机带动一组(磁头)到相对应的碟片上并确定读取正面还是反面的碟面,磁 ...
- Linux File System
目录 . Linux文件系统简介 . 通用文件模型 . VFS相关数据结构 . 处理VFS对象 . 标准函数 1. Linux文件系统简介 Linux系统由数以万计的文件组成,其数据存储在硬盘或者其他 ...
- 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 ...
随机推荐
- weblogic stuck实验2014-11-14
以往对weblogic stuck认识是: 1.会造成系统总体慢. 2.在weblogic console中线程监控中会有显示. 3.weblogic使用队列处理线程.隔一段时间会扫描线程队 ...
- 在Win7中IIS配置Asp.Net虚拟文件夹的方法及错误总结!
在Win7中IIS配置Asp.Net虚拟文件夹的方法总结! 一.右键[站点].点击[加入虚拟文件夹]或[虚拟应用程序],笔者建议最好建立虚拟应用程序,由于这就跟一个站点差点儿相同.不用考虑路径问题. ...
- vue的组件(先学习其他的ES6知识,之后再看这个) (未完)
https://blog.csdn.net/qq20004604/article/details/56965703
- 在Visual Studio 2013顯示SCSS詳細錯誤訊息
在WebEssentials套件加持之下,Visual Studio 2013可以直接編修SCSS,每次存檔自動編譯出css.min.css及.map,非常方便.但初心者如我,寫錯語法在所難免,一旦造 ...
- PHP REST架构简单设计
REST是什么? REST(Representational State Transfer表述性状态转移)是一种针对网络应用的设计和开发方式,可以降低开发的复杂性,提高系统的可伸缩性. REST的特点 ...
- Atitit.判断汉字的编码 regedit 注册表里面的reg_sz
Atitit.判断汉字的编码 regedit 注册表里面的reg_sz 1. 可以判断出是unicode编码1 2. 有下面分割ucs2 大头小偷编码1 3. 使用小偷编码测试1 4. 注册表里面的r ...
- C#多线程方法同步
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 如何将git 关联到Pycharm
一,预置条件 1,安装pycharm 2,安装git 仓库 二,关联步骤 1,打开Pycharm File | Settings | Version Control | Git 2,配置需要关联的 ...
- Django-model进阶(中介模型,查询优化,extra,整体插入)
QuerySet 可切片 使用Python 的切片语法来限制查询集记录的数目 .它等同于SQL 的LIMIT 和OFFSET 子句. ? 1 >>> Entry.objects.al ...
- oracle9i 精简版客户端界面没有显示实例名
1.右击"我的电脑",选择"属性"菜单项 2.在弹出的窗口中,点击"高级系统设置" 3.在弹出的窗口中,选择"环境变量" ...