Use Powershell to get Disk Information

Here is a great way to use powershell to check disk information, View ACL, and copy results to UNC path. The script is modular so you can add whatever you want. Cut and paste the code for your own use.

diskInformation.ps
Image from code
#acquire physical disk information via WMI
gwmi win32_logicaldisk -computer pluto -filter "drivetype=3"
#or use a script
c:\scripts\diskinformation.ps1
#use Get-Childitem to enumerate directory (DIR)
get-childitem \\wally\files\ -recurse

get-childitem \\wally\files\ -recurse | Sort Length -desc | Select FullName,
      Length,CreationTime,LastWriteTime
#Check ACL Get-ACL to look at security
get-acl \\wally\files\announce.txt | format-list *
(get-acl \\wally\files\announce.txt).AccessToString

(get-acl \\wally\files\announce.txt).owner
#set-acl can modify security by copying on ACL to another
#here it is before
get-acl \\wally\files\IAmaTest.txt | format-list
#now we'll copy
get-acl \\wally\files\public.txt | set-acl \\wally\files\IAmaTest.txt
#here it is after
get-acl \\wally\files\IAmaTest.txt | format-list
#use WMI to create a share
C:\SCRIPTS\new-share.ps1
net view \\wally
#I can use WMI to look at share security
c:\powershell\diskInformation.ps
source code

Check if patch exists and report to Excel

Using Powershell and Microsoft Excel

Here is a great way to use powershell to check if a particular patch has been applied to a list of machines. The script is modular so you can replace the KB numbers when needed.

Syndicate content