Solved

2 Powershell scripts don't seem able to capture data on all machines

Posted on 2016-08-19
4
84 Views
1 Endorsement
Last Modified: 2016-08-23
I have 2 different Powershell scripts downloaded from the internet. They work well but only on selected machines. On some machines, they fail to collect any data even though I have physically confirmed the data exists. What could need to be added or adjusted on these machines to allow the scripts to work?

Scripts are attached. I did not create these, they created by some very awesome Powershell programmers on Powershell.com and Reddit.
The long one goes through the steps and it visibly collects the data, I can see where it returns the usernames and the machine names. But then the output is always a noreply-date.csv. It seems like it collects the data but can't put it in the file for some reason.

The shorter one collects the data on  machines  by creating a ps session on that remote computer and putting the data in a file then copying that file back to my machine. It doesn't always collect the data, though. I have confirmed on a few machines that the data exists by going to them and looking but the text file is still blank.

Please let me know what might be causing these issues and any suggestions to get resolve them.

Thanks
GetMappedNetworkPrinters.txt
Getnetworkprinters.txt
1
Comment
Question by:Gjdalton
  • 2
4 Comments
 
LVL 17

Expert Comment

by:pjam
ID: 41762487
Possibly "Remote Desktop not Enabled?"
0
 
LVL 22

Accepted Solution

by:
Adam Leinss earned 500 total points
ID: 41762524
Script 1:

Very cool script!  For anyone else that wants to play with it: you need to download the PSRemoteRegistry module (https://psremoteregistry.codeplex.com/releases/view/65928) and run Powershell elevated.  Works perfectly fine for me.  I would suggest using WMI Explorer (https://wmie.codeplex.com/) on the "problem" PCs and see if that works.  The Remote Registry service should be turned on for each PC.  

Script 2:

The 2nd script requires remote PowerShell (WinRM) to be enabled, which we don't have in our environment, so I will be unable to test that one.
1
 

Author Comment

by:Gjdalton
ID: 41765736
Thank you! Still reviewing answer to see if I can make it work with those settings.
0
 

Author Closing Comment

by:Gjdalton
ID: 41766825
This was very helpful. I tested several machines after installing the psremote-registry piece and they all worked well. I would still like to get the other to work correctly. I have ps-remoting enabled on the machines so I think it is something wrong in the code or some patch on the machines.

Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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...
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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…

679 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