Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
669 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
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…
Screencast - Getting to Know the Pipeline

610 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