-3

I am working on a windows server 2k12 (VM), is there an easier way beside netstat, to scan/view all open ports/process in windows server with powershell.

I also use window firewall, but I was told its not sure/all encompassing view open ports, is this true?

Can you help me wrap the two into a powershell script, and in the second script, how can I get the app names into the commands

  1. Scan/display all open ports netstat –ano ¦find /i “listening” this is a console view, and does not have the process name, I have to manually look at the PID in task manager to correlate the process name, while I mostly use this, I see TCPeye and CurrPorts, but they both seem to be for older versions of the server. Is there a function or feature inside server manager?
  2. Run/Install a bunch of programs located a folder - (for e.g. I have a collection of files I need to install, notepad++, Systernals etc, that I put in the software folder on my desktop)

    Install-Application -InstallerPath \\server\Desktop$\SoftwareFolder\(how to find the application/exes in the folder) -InstallerParameters "/S" -RegistryKey HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\(some appName) -RegistryName DisplayVersion -RegistryValue 6.7.8.2 -LogPath \\Server\Software$\logfiles\

everest
  • 103
  • 9
  • 1
    What have you tried? SO is to help folks with programming problems - not as a script writing service. – Χpẘ Dec 03 '15 at 22:41
  • 0. There is no code in your question, meaning you probably haven't tried anything and expect us to do your job 1. `netstat -an` 2. Your question is not understandable (*Start Install*?), and even without only 1 verb, do you think *install a bunch a programs in a folder* is an accurate description of what you need to do ? – sodawillow Dec 04 '15 at 09:12
  • added the code samples – everest Dec 05 '15 at 20:09
  • What is wrong with scripting `PortQry`? – user4317867 Dec 05 '15 at 21:52
  • @user4317867 thanks for that suggestion, did not know it existed, this is what I was looking for some advise based on exp! – everest Dec 06 '15 at 02:57
  • @everest You're welcome, I added more detail and posted an answer. Please consider accepting that answer if it's helpful. – user4317867 Dec 06 '15 at 16:26

1 Answers1

1

You could use PowerShell to script PortQry.exe and using this question for help on capturing the output from PortQry.exe into a variable for further processing.

As for installing software, I use Start-Process

$args = "/param1 something /param2 somethingElse"
While (Start-Process -FilePath d:\setup.exe -ArguementList $args -Wait)
 { (Start-Sleep -seconds 5)} #could output a line to the console here
Community
  • 1
  • 1
user4317867
  • 2,397
  • 4
  • 31
  • 57