Create users and groups, add into a group and share directory
#Read file, create users and groups, add a user into a group, create a directory for each user and share directory. #File content: #g,grupo #u,pepe,pass,grupo foreach($val in Get-Content C:user.txt) {...
View ArticleInformation about process
#Getting process list foreach($proces in get-process) { #Process information $proceso=$proces.Name+”.exe” $url=”http://elarchivo.es/proceso/”+$proceso+”.html” ((Invoke-WebRequest $url).AllElements |...
View ArticleReading username and password from file in MD5 and do a login
#Read user and password $user=Read-Host $pass=Read-Host #Read MD5 file user.txt, example content: #24c9e15e52afc47c225b757e7bee1f9d,4604c8f5d958fea18967bbc7504d0f03 is user1,passwoasdfK$ #Convert user...
View ArticleCreate users with passwords on a remote computers
#Create users with passwords on a remote computers #Important #Need activate: #PS C:WindowsSystem32WindowsPowerShellv1.0> C:WindowsSystem32svchost.exe -k NetworkService #PS...
View ArticleExtract number of followers of a user from twitter
#List Twitter Accounts #Example content: #https://twitter.com/Microsoft foreach($url in Get-Content c:powershelllistado.txt) { $sinurl=$url.Replace(“https://twitter.com/”,””) $result =...
View ArticleGroup by MAC in ARP
$all=”” $arps=arp -a foreach($line in $arps) { if($line -match “mico”) { $line $a=$line.Replace(” “,” “) $a=$a.Split(” “) $all=$all+”*”+$a[9] } } $all.Split(“*”) | Group-Object | Sort-Object Count...
View ArticleExtract number of followers of a user from twitter (new version)
#List Twitter Accounts #Example content: #https://twitter.com/Microsoft foreach($url in Get-Content c:powershelllistado.txt) { $sinurl=$url.Replace(‘http://twitter.com/’,”) $result = Invoke-WebRequest...
View ArticleSearch in the Public MA-L Listing (for example MAC)
#Searching the list will allow you to determine whether your company or any parent/subsidiary companies already own an assignment. When searching the public listing, addresses should be entered as...
View ArticleList computers using net view and compare the MAC
function Get-NetView { switch -regex (NET.EXE VIEW) { “^\\(?<Name>S+)s+” { $matches.Name } } } foreach($i in Get-NetView) { (get-wmiobject -class “Win32_NetworkAdapterConfiguration” -computername...
View ArticleList computers using net view, compare the MAC and search in the Public MA-L...
function Get-NetView { switch -regex (NET.EXE VIEW) { “^\\(?<Name>S+)s+” { $matches.Name } } } #Search MAC in http://standards.ieee.org/...
View ArticleAnálisis de conexiones TCP/IP (NETSTAT) (Parte 1)
El comando NETSTAT muestra estadísticas del protocolo y conexiones TCP/IP actuales. Desde la línea de comandos PowerShell podemos ejecutar comandos para obtener información. Mostrar información sobre...
View ArticleRead PDF (iTextsharp)
#Download http://sourceforge.net/projects/itextsharp/ #Set paths: iTextSharp, PDF $iTextSharpFilePath = “C:\Users\user1\Downloads\PowerShell.PDF\itextsharp.dll” $pdfFilePath =...
View ArticleAbout results (Google)
$urls=”https://www.google.com/search?q=powershell” $result=Invoke-WebRequest $urls $en=$result.AllElements | ? {$_.id -eq “resultStats”} foreach($aen in $en.innerText){ $aen } The post About results...
View ArticleMorse code
#Morse code #morse.txt #A|. – #B|– . . . #C|– . – . #Ch|– – – – #D|– . . #E|. #F|. . – . #G|– – . #H|. . . . #I|. . #J|. – – – #K|– . – #L|. – . . #M|– – #N|– . #Ñ|– – . – – #O|– – – #P|. – – . #Q|– –...
View ArticleDownload videos from YouTube, convert MP4 to JPEG and convert JPEG to HTML
#Open file (Get-Content F:\power\urls.txt) | %{ #URL Write-Host $_ #Save file in c:\power Set-Location F:\power #Use youtube-dl to download video from Youtube #Youtube-dl is a small command-line...
View ArticleSearching TeamViewer in our system
#Searching open port in Netstat #Process id $processid=Get-Process -Name TeamViewer_Service netstat -ano | ForEach-Object { Select-String $processid.Id -input $_ -AllMatches } #Searching the Registry...
View ArticleSearching the Registry: IP addresses
Write-Host “IP addresses:`n” Get-ChildItem HKCU:\ -rec -ea SilentlyContinue | ForEach-Object { Select-String “\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b” -input (Get-ItemProperty -Path $_.PsPath)...
View ArticleUpload files to FTP automatically and save a copy
ForEach ($file in gci F:\power\videos){ $file $ftp=”ftp://user:pass@domain.com/pub/$File” $webclient = New-Object System.Net.WebClient $uri = New-Object System.Uri($ftp) $webclient.UploadFile($uri,...
View ArticleSearching the Registry: URLs
Write-Host “URLs:`n” Get-ChildItem HKCU:\ -rec -ea SilentlyContinue | ForEach-Object { Select-String “\b(ht|f)tp(s?)[^ ]*\.[^ ]*(\/[^ ]*)*\b” -input (Get-ItemProperty -Path $_.PsPath) -AllMatches |...
View ArticleCreating Folders for each user (Example)
#Creating folders for each user Set-Location F:\power\ #User list in a file ForEach($user in Get-Content .\names.txt) { #Create folder for each user #If the item you are trying to create already exists...
View Article