Enumerate Installed Com Objects Explained
Home Columns #PSTip Get a list of all Com objects available. 5 #PSTip Get a list of all Com objects available. Posted by Jaap Brasser on June 27, 2013 A tutorial on.
Hello, I need a script that runs on Win XP all the way to Windows 7 that can be run on machines which will output all user printers. Duplicates are fine. This script would be deployed with Altiris Deployment.
I have tried running the powershell command: get-WmiObject -class Win32_printer ft name, systemName, shareName Select all However, this just returns all printers local to the user who ran it, not all of the users on the machine. For example: User 1 has printers A, B, C installed User 2 has printers C, D, E installed We run the script on the above machine, it would output something like A,B,C,C,D,E are installed on that computer. I have looked around the internet for a while and cannot seem to find anything that outputs every printer on the computer. Thank you ssd-tech. Do you need to deploy it from Altiris?
Why not just run a script from your computer that has all of the computer names and then query remotely to each PC in the server list? Something like below.
To get your initial server list simply do the following command Get-ADComputer -Filter * -Properties * select Name Export-csv 'c: ServerExport.csv' Note: for the script below make sure that the Column Heading in the ServerExport.csv file is computername. $ServerList = Import-Csv 'c: yourcsvfilehere.csv' $Serverlist = foreach ($server in $ServerList) { $server.computername Get-WmiObject -Class win32_printer -ComputerName $ServerList.computername Select-Object Name, ShareName, SystemName Export-Csv 'c: PrinterResults.csv' Select all This will export all of the printers into another CSV file with the headings Name, ShareName, and SystemName. Total War Shogun 2 Patch Gamecopyworld Dying there. Hope this helps!
I tried to use this script on print server 2008 and i am getting errors. Would be willing to tell me what is wrong? Getprinter.ps1 Exception calling 'OpenSubKey' with '1' argument(s): 'Requested registry access is not allowed.' At C: temp getprinter.ps1:8 char:5 + $regProfileList = $regHKLM.OpenSubKey('SOFTW ARE Micros oft Window s NT Current.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~ + CategoryInfo: NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId: SecurityException You cannot call a method on a null-valued expression. At C: temp getprinter.ps1:10 char:22 + foreach ($sid in $regProfileList.GetSubKeyN ames()) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + CategoryInfo: InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId: InvokeMethodOnNull CloseAllRegs: The term 'CloseAllRegs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C: temp getprinter.ps1:24 char:5 + CloseAllRegs + ~~~~~~~~~~~~ + CategoryInfo: ObjectNotFound: (CloseAllRegs:String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException Exception calling 'OpenRemoteBaseKey' with '2' argument(s): 'The network path was not found. ' At C: temp getprinter.ps1:7 char:5 + $regHKLM = [Microsoft.Win32.RegistryK ey]::OpenR emoteBaseK ey('LocalM achine'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~ + CategoryInfo: NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId: IOException Exception calling 'OpenSubKey' with '1' argument(s): 'Requested registry access is not allowed.' At C: temp getprinter.ps1:8 char:5 + $regProfileList = $regHKLM.OpenSubKey('SOFTW ARE Micros oft Window s NT Current.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~ + CategoryInfo: NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId: SecurityException You cannot call a method on a null-valued expression. At C: temp getprinter.ps1:10 char:22 + foreach ($sid in $regProfileList.GetSubKeyN ames()) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + CategoryInfo: InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId: InvokeMethodOnNull CloseAllRegs: The term 'CloseAllRegs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C: temp getprinter.ps1:24 char:5 + CloseAllRegs + ~~~~~~~~~~~~ + CategoryInfo: ObjectNotFound: (CloseAllRegs:String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException PS C: temp.
Microsoft® Windows® 2000 Scripting Guide Knowing the software packages that have been installed on a computer is useful for many reasons. Among other things, this knowledge helps you: • Gain insight into what the computer is used for. A computer that does not have a word processor installed is probably not used for writing memos or other documents. • Ensuring that only licensed software, and only approved software, is in use in your organization.