I have to search the internet (google chrome or Bing browser) for all the apothekes of Kaiserslautern and Landkreis Kaiserslautern with at least 3 subsidiaries in Germany and obtain in an Excel table the url of these apothekes, the name, the address, the email, phone number and the name of the Geschäftsführer ( manager). I use an ISE Powershell script for this.<\/p>\n
Here is my script: I need to run as administrator first. I have to search the internet (google chrome or Bing browser) for all the apothekes of Kaiserslautern and Landkreis Kaiserslautern with at least 3 subsidiaries in Germany and obtain in an Excel table the url of these apothekes, the name, the address, the email, phone number and the name of the Geschäftsführer ( manager). I use an ISE Powershell script for this.<\/p>\n Here is my script: I need to run as administrator first. Kaiserlautern ist einer meiner Lieblingsorte - ich war schon oft geschäftlich unterwegs<\/p>\n Thanks for the question - and just a small point. When you post code here, can you use the </> tool. That makes the code easier to read and that, in turn, increased your chances of a brilliant answer.<\/p>\n Also, when you write pipelines, I always recommend better indentation. Like this:<\/p>\n Looking at that, a fundamental mistake:<\/p>\n NEVER put anything after Format-Table (or any Format-*) command. The rule is Format right, everrthing else left. Format-Table converts the data into formattring details which are not what you want.<\/p>\n Also, you have some errors in the code - I THINK you want somethign closer to;l<\/p>\n Even then, I suspect that this will not work since you are piping the service details which so not contain the properties you want.<\/p>\n I wish I could help more but screen scraping is something I just don;t grok!<\/p>","upvoteCount":2,"datePublished":"2021-01-20T10:57:01.000Z","url":"https://community.spiceworks.com/t/can-you-correct-my-script-for-webscraping/787975/2","author":{"@type":"Person","name":"DoctorDNS","url":"https://community.spiceworks.com/u/DoctorDNS"}},{"@type":"Answer","text":" Ha my Dad is from Kaiserlautern, well actually Mainz, but he moved to Lautern as a child.<\/p>\n If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n
\nThen I type Set-execution policy (if restricted)
\nGet execution Policy unrestricted or open registry Editor via Key + R and type regedit and press enter.
\nOpen the local group policy key + R and type gpedit.msc and press enter. If prompted by UAC, click on yes.
\n$Apotheken=”Kaiserslautern und Landkreis”
\n$url=” http://googlechrome.com?q<\/a> = contact information for $Apotheken”
\n$result=Invoke-WebRequest $url $elements=$results:All Elements|where class -eq “3 filialen”(in Germany)
\n$Apotheken = (Get-Service -DisplayName Apotheken<\/em> | Select-Object -Property DisplayName, url,address,telefon,email address,Geschäftsführer Name)|Format-Table -Proprety Name,url,Address,Telefon,Geschäftsführer Name| export “C:\\temp\\Apotheken.csv”<\/p>","upvoteCount":5,"answerCount":3,"datePublished":"2021-01-20T07:30:21.000Z","author":{"@type":"Person","name":"spiceuser-fl76c","url":"https://community.spiceworks.com/u/spiceuser-fl76c"},"suggestedAnswer":[{"@type":"Answer","text":"
\nThen I type Set-execution policy (if restricted)
\nGet execution Policy unrestricted or open registry Editor via Key + R and type regedit and press enter.
\nOpen the local group policy key + R and type gpedit.msc and press enter. If prompted by UAC, click on yes.
\n$Apotheken=”Kaiserslautern und Landkreis”
\n$url=” http://googlechrome.com?q<\/a> = contact information for $Apotheken”
\n$result=Invoke-WebRequest $url $elements=$results:All Elements|where class -eq “3 filialen”(in Germany)
\n$Apotheken = (Get-Service -DisplayName Apotheken<\/em> | Select-Object -Property DisplayName, url,address,telefon,email address,Geschäftsführer Name)|Format-Table -Proprety Name,url,Address,Telefon,Geschäftsführer Name| export “C:\\temp\\Apotheken.csv”<\/p>","upvoteCount":5,"datePublished":"2021-01-20T07:30:21.000Z","url":"https://community.spiceworks.com/t/can-you-correct-my-script-for-webscraping/787975/1","author":{"@type":"Person","name":"spiceuser-fl76c","url":"https://community.spiceworks.com/u/spiceuser-fl76c"}},{"@type":"Answer","text":"$Apotheken=”Kaiserslautern und Landkreis”\n$url=”http://googlechrome.com?q = contact information for $Apotheker” \n$result=Invoke-WebRequest $url $elements=$results:All Elements|\n Where-Object class -eq “3 filialen”(in Germany) \n$Apotheken = (Get-Service -DisplayName *Apotheken* | \n Select-Object -Property DisplayName, url,address,telefon,email address,\n Geschäftsführer Name)| \n Format-Table -Proprety Name,url,Address,Telefon,Geschäftsführer Name| \n export “C:\\temp\\Apotheken.csv”\n<\/code><\/pre>\n
$Apotheken=”Kaiserslautern und Landkreis”\n$url=”http://googlechrome.com?q = contact information for $Apotheker” \n$Result=Invoke-WebRequest $url $elements=$results:All Elements|\n Where-Object class -eq “3 filialen”(in Germany) \n$Apotheken = (Get-Service -DisplayName *Apotheken* | \n Select-Object -Property DisplayName, url,address,telefon,email address,\n GeschäftsführerName) | # not sure about this property name\n Export-CSV “C:\\temp\\Apotheken.csv”\n<\/code><\/pre>\n