?
Solved

powershell script to export a value of register keys and check if .exe file exist in specific folder

Posted on 2011-03-10
6
Medium Priority
?
666 Views
Last Modified: 2012-05-11
Hi,

I need a script to do this for a txt file with the server name like this:

server1
server2
server3
.....

the script must check all this remotely:

1-Check if .exe file exist in this 2 folders and export the file name if it is .exe file
      -c:\test1\folder1
      -c:\test2\folder2

2-Export all keys and Data for this registry keys:
       -HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\table pc
        -HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\table pc

i need a result file with all this information.

Thanks if you can help me.
0
Comment
Question by:cawasaki
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 1

Accepted Solution

by:
robertodf earned 2000 total points
ID: 35096888
Here goes the first part, the one that reads the file with the name of the servers and checks for file existence .

please test it in your environment.

Regards
foreach ($server in $(get-content .\servers.txt)){

	$files=get-childitem \\$server\C$\test1\folder1	

	foreach ($file in $files){

		if ($file.Extension -eq ".exe") {

		write $file.Name

		}

	}

	$files=get-childitem \\$server\C$\test2\folder2	

	foreach ($file in $files){

		if ($file.Extension -eq ".exe") {

		write $file.Name

		}

}

Open in new window

0
 

Author Comment

by:cawasaki
ID: 35099358
ok i will test, and for the part 2:

2-Export all keys and Data for this registry keys:
       -HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\table pc
        -HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\table pc

???

thanks for your help
0
 

Author Comment

by:cawasaki
ID: 35099674
ok first test:

[PS] C:\Temp\PLOP>.\plop.ps1
Missing closing '}' in statement block.
At C:\Temp\PLOP\plop.ps1:25 char:1
+ } <<<<

so i added the missed }


and it work but i have 0 result, not file nothing and i needalog to check it after i execute the script.

thanks
0
Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

 

Author Comment

by:cawasaki
ID: 35099738
oki have test and my constat:

1-if in one server in the list one folder not exist the script exit check

2- the result is just viewed in the screen,i need a result file where i can check the result like this:

server1:
file.exe, file2.exe....

server2:
file.exe, file2.exe....

server3:
file.exe, file2.exe....

Thanks
0
 

Author Comment

by:cawasaki
ID: 35107068
Up , any help plz?
0
 

Author Closing Comment

by:cawasaki
ID: 35123860
i accept your partial script.

Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question