# open destination folder (and create it if needed) $folder = 'c:\drawings' $exists = Test-Path-Path$folder if (!$exists) { $null = New-Item-Path$folder-ItemType Directory } explorer $folder
# walk all 33 web pages that www.metabene.de offers 1..33 | ForEach-Object { $url = "http://www.metabene.de/galerie/page/$_"
# navigate to website... $webpage = Invoke-WebRequest-Uri$url-UseBasicParsing
# take sources of all images on this website... $webpage.Images.src | Where-Object { # take only images that were uploaded to this blog $_-like'*/uploads/*' } } | ForEach-Object { # get filename of URL $filename = $_.Split('/')[-1] # create local file name $destination= Join-Path-Path$Folder-ChildPath$filename # download pictures Invoke-WebRequest-Uri$url-OutFile$destination }
# get invalid characters and escape them for use with RegEx $illegal =[Regex]::Escape(-join [System.Io.Path]::GetInvalidFileNameChars()) $pattern = "[$illegal]"
# get invalid characters and escape them for use with RegEx $illegal =[Regex]::Escape(-join [System.Io.Path]::GetInvalidPathChars()) $pattern = "[$illegal]"
# you are connecting to this computer # the computer in $destinationcomputer needs to have # PowerShell remoting enabled $DestinationComputer = 'server12'
# this is the server you want to communicate with using CredSSP # the server needs to have PowerShell remoting enabled already $Server = 'NameOfServer'
Enable-WSManCredSSP-Role Client -DelegateComputer$Server-Force Invoke-Command { Enable-WSManCredSSP-Role Server } -ComputerName$Server