#Tony Unger #Tonyunger.com #Scans all AD servers for Shares #50 servers at a time #Will Prompt for creds $i =0 import-module activedirectory cls $creds = Get-Credential $myCol = @() $Domain = "microsoft.com" $Servers = Get-ADComputer -server $Domain -Filter {(OperatingSystem -Like "Windows Server*")-and (enabled -eq "true")} -Property SamAccountName | Select -expand Name $scriptblock = { param( [string]$server, $creds ) Get-WmiObject Win32_Share -ComputerName $server -Credential $Creds | select * } foreach($server in $Servers){ $i++ $running = @(Get-Job | Where-Object { $_.State -eq 'Running' }) Write-Progress -Activity "Gathering computer info" -status "Currently on $server -- $i of $Servers.count" -percentComplete ($i / $Servers.count*100) if ($running.Count -le 50) { Start-Job -ScriptBlock $scriptblock -Name $server -ArgumentList $server, $creds } else { $running | Wait-Job } } while ($running.Count -ge 1) { sleep 1 $running = @(Get-Job | Where-Object { $_.State -eq 'Running' }) } foreach ($job in Get-Job ){ $recjobs = Receive-Job -Keep -Job $job foreach ($recjob in $recjobs){ $Detail = New-Object PSObject $Detail | Add-Member Noteproperty Name $recjob.name $Detail | Add-Member Noteproperty Path $recjob.path $Detail | Add-Member Noteproperty Server $recjob.__SERVER $myCol += $Detail } } $myCol $myCol | export-csv -Path c:\TEMp\shares\output.csv -notype
These are just random notes and programs that may have incomplete descriptions. Any scripts or programs use at your risk
Thursday, July 9, 2015
Powershell: Jobs - Search for shares in ad windows servers
Job script to search for shares in a active directory environment.
Update $Domain to your domain and run
Subscribe to:
Post Comments (Atom)
-
Running solidcore you may run into a problem where you have to disable it with out using epo or the local CLI Here are the steps. ...
-
Purpose: This script will search AD for all servers and report any shares(includes printers) This script will do 50 servers...
-
Save the following as a batch file and run as a local admin account: REM REM icacls c:\Windows\inf\usbstor.inf /reset i...
3D printing opens up a whole new world of potentialities for small Bike Helmets for Kids businesses. You can use 3D printer models to create small products, prototypes, or elements for equipment. These machines permit you to create your own custom designs. But if you’re not excited about ranging from scratch, you'll be able to|you presumably can} simply search for current information. 3D printers use a variety of|quite lots of|a wide range of} different plastics or resins to build a real, physical model from a digital 3D model in your laptop. A digital model could be created using Computer Aided Drafting software, or different frequent 3D modeling software.
ReplyDelete