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 ...
随机推荐
- spring中aop以xml配置方式
1 引jar包 springAOP\aopalliance.jar springAOP\aspectjrt.jar springAOP\aspectjweaver.jar springAOP\spri ...
- spine findBone
spBone* bone=skeletonAnimationNode->findBone("boneName"); CCPoint boneWorldPos=ccp(bone ...
- JS高程3:Ajax与Comet-XMLHttpRequest对象
XHR 的用法 XHR对象,即XMLHttpRequest对象,下面看看他常见的属性和方法. open()方法 它接受 3 个参数:要发送的请求的类型("get". "p ...
- Java - web.xml文件中可以配置哪些内容?
web.xml用于配置Web应用的相关信息,如:监听器(listener).过滤器(filter).Servlet.相关参数.会话超时时间.安全验证方式.错误页面等,下面是一些开发中常见的配置: ①配 ...
- Entity简单使用
urlEntity: //定义 package com.example.cc.ecustapp.Model; /** * Created by weijiawang on 2016/3/8. */pu ...
- Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 解决方法
1. 代码 SHOW VARIABLES LIKE 'character_set_%'; 查看一下 显示 +--------------------------+------------------- ...
- linux学习笔记18--文件/chmod/chown/chgrp
文件类型与扩展名: Linux文件类型和Linux文件的文件名所代表的意义是两个不同的概念.我们通过一般应用程序而创建的比如file.txt.file.tar.gz ,这些文件虽然要用不同的程序来打开 ...
- Tomcat 下启用 https:// 访问
步骤: 1 创建 .keystore 文件 JDK中自带了keytool工具用于生成证书文件 keytool工具在$JAVA_HOME/bin 目录下可以使用命令 keytool -genkey -a ...
- linux应用time和timezone
linux中应用层(非内核层)time是怎样处理的?时区是怎样设置的?夏令时时是怎样实现的?NTP时间同步是怎么回事?本篇文章就在嵌入式linux应用中time和timezone相关问题总结. 1. ...
- 【犀牛书笔记】JavaScript正则表达式的模式匹配
正则表达式,是一个描述字符模式的对象. JavaScript用RegExp类表示正则表达式 String和RegExp都定义了相关方法 原创文章,转载请注明:http://www.cnblogs.co ...