Cant pull windows printers with win32_printer class - windows

In pulling windows printers from windows I am using Win32_Printer class, however it is not pulling printers that are shared from another computer (basically a print server).
It pulls locally added printers no problem but those shared from another computer must be a different stored class?
I've looked through the dev app resource and haven't stumbled upon anything yet

Related

Automating remote desktop connection

We use many remote desktops in our development environment and there are many servers deployed in multiple environments. It is tedious to remember their IP addresses, usernames, and passwords. I want to write a small utility with buttons on it. When clicked, I want to start those remote desktops, automatically fetching usernames and passwords from some list.
I know there is a command line equivalent for MS Remote Desktop: mstsc.
This question suggests to do this as follows:
cmdkey /generic:TERMSRV/"computername or IP address" /user:"username" /pass:"password"
mstsc /v:"computer name or IP"
I run the first line, and it says credential successfully added. Then when I run the second line it simply runs Remote Desktop Connection for the specified IP address and asks for username and password. I would like it to simply open the remotely connected desktop at specified IP address by automatically applying the credential specified in cmdkey.
What's wrong here? Is it possible using such PowerShell script?
Can I invoke this script through an HTML page (since there are many other resources that I will be laying onto the webpage which will serve as one spot links for we developers, so that we will not be wasting time and effort finding them each time we want them)? Is it possible by registering the application to a URI scheme?
Is there another (standard) way?
The problem in your attempt is the parameter /generic.
According to the official website for cmdkey, /generic
identifies the computer or domain name that this entry will be associated with.
In my example, I will call the computer Computer01.
Do you want the credentials associated with TERMSRV/Computer01 ? (Like your example /generic:TERMSRV/"computername or IP address " said)
No, you want it associated to the normal computername Computer01.
Then you have to remove TERMSRV/.
The working result is:
cmdkey /generic:"computername or IP" /user:"username" /pass:"password"
To your other questions:
See the answer above
I don't know if it's possible with HTML only. I don't think so. But I also implement some PowerShell scripts into ASP.NET. This works.
See answer above.
A lot has changed since 2013. Many system operators already suggested to use ready-made tools which does this. Back in year 2013, Windows store wasn't that great a place (*my opinion). But now it's OK.
There is Microsoft's own Remote Desktop application in the store. The application is universal, that is, it runs on PCs, mobile phones, and holographic devices.
What's good? Microsoft has made the same app available on Android. I have tried for PC and Android. Both work great.
So have a try. I am regular user of these applications now.

Linux: Set permissions to Windows network computers

Im working on a linux server at work and I wanted to find out how to set certain permissions to Windows users connected to that server.
Im trying to assign permissions to windows machines connected to the linux server?
This is how the network is setup... There are different computers that are connected in a network, that connects to a dedicated lunix (debian) server. On the server there is a shared folder that all of the computers can access.
What I would like to do is set a read & execute permission to a certain computers in that Windows network. Is there a way to set certain permission to a specific computer by its Computer Name (Full computer name, ex. Garys-pc) and Workgroup Name through the linux system to set certain permissions?
How can I do this? Im a novice with the linux operating system so I would appreciate any help with this. Any advice will be appreciated.
The smb.conf(5) man page, VARIABLE SUBSTITUTIONS section, details all variables that can be used in the configuration file. These variables can be used in an include directive in order to include other files that can modify global behavior.

Windows 7 Service differences between local system and local service

I have a rather complicated toolchain so prepare for a lengthy post until getting to the problem:
I managed to get PDFCreator and a virtual PDF creating printer under Windows 7 running in server mode as a service. Next step in the process is PDFCreator calling a VBScript after the PDF is created. The script uploads the PDF to our server via WebService and polls the server for a resulting PDF. When the resulting PDF has been downloaded, the VBScript needs to print it to a confiured printer.
Now for printing I was using the integrated COM object of PDFCreator which gives access to GhostScript. This worked perfectly onder Windows XP for any account the PDFCreator service was started. For example as a domain user to have access to shared printers from the VBScript, as the user context is the same as the PDFCreator service.
Now I tried the same for Windows 7 and used the "local system" account as before, because my test printer is a local one (and works, i.e. TestPage). Effect is that the wscript stays in the task manager and never finishes. Next I activated Interactive mode for the service and a saw Ghostscript asking for the printer to print to. The Printer does exist as I checked before calling GS within the VBScript, but out of any reason GhostScript does not see the printer although in the dialog opened to select the printer, the printer is there.
After days long searching and unsuccessfully trying even a dedicted new administrator account for the servive with no success I finally came up with a way to get it working. Changing the user for the PDFCreator service to "locale service" I first got an error that the PDFCreator COM object creation failed. Okay I thought this makes sense, as "locale service" has less rights that "locale system". I got around this limit by changing the access right under comexp.msc and granted "locale service" rights for local and remote COM and Script access. Voilá, everything worked.
What I do not understand: Why is Ghostscript under the "locale service" account capable to find the printer although the account has less rights that "locale system"?
And: Which access right do I need to set for "locale system" or any other user account to make it work?
Or: Is there a comprehensive list of detailed differences between these accounts?
Thank you very much and greetz,
GHad
The answer can be found here: KB184291
It's about ASP/IIS running under "local system" account and cannot print because the printers are not available under the .DEFAULT user. Copying over registry entries helps.
Greetz,
GHad

"No printers are installed." problem when using excel 2003 interop sheet.PageSetup through a WCF service

We have a WCF service that generates an Excel file off of a template and feeds it back to the client in a byte array. For some reason, we are getting an error when we try to do this:
sheet.PageSetup.CenterHeader = sheet.PageSetup.CenterHeader.Replace("[customerName]", customerName).Replace("[dateTime]", date.ToShortDateString());
When it hits this line, we get this error message:
No printers are installed. To install a printer:
In Microsoft Windows 2000, click Start, point to Settings, and then click Printers. Double-click Add Printer.
In Microsoft Windows XP, click Start, and then click Printers and Faxes. Under Printer Tasks, click Add a printer.
Follow the instructions in the wizard.
The service runs under the LocalSystem account. When we first deployed this service, it was to an x64 machine and had the same issue. Our dev environment is x86 so we moved the service to another server that was x86 and it worked fine for a while. It recently stopped working and is now giving us this error message again. I am pretty sure it was becuase of a mass windows update that was done on the app server recently.
Funny thing is, I tried changing the service to "allow interaction with the desktop" and it didn't work, but when our sysadmin did that same thing, it worked for one file generation but is not working now.
There are printers installed on the machine, both on domain accounts and local accounts. I've also tried running the service under a different account, but then I wasn't able to connect to the service due to some SSPI error. We tried using the Network Service account but then the app couldn't see the service at all. We've restarted the service after each change also to no avail.
What I do know about the "PageSetup" part of the sheet object is that it needs to have a printer installed to access it at all, even if you aren't printing. I was unable to figure out a way to trick the machine into thinking the LocalSystem account has a printer installed.
We figured out the problem, I had my config file still pointed at the x64 server :(
As to why it won't work on x64 (to my knowledge) - since office 2003 is x86, it needs an x86 print spooler in order to work correctly. I don't know of any way to get an x86 print spooler on an x64 OS so we just stuck it on the x86 server.

How do I remotely obtain a system's network shares and connections?

I'm looking for a way to obtain information similar to the following console applications, remotely:
net use
net share
netstat -ano
However, I need to be able to do this without running a 3rd party application on the system. This effectively rules out using psexec to execute the command remotely, because psexec would then be installed as a service.
I should add that I have administrative credentials on the remote system. I've considered using WMI's remote execution ability, but that requires me to write output to a file and then retrieve it. It's possible, but I'd like to know if anyone has a better way.
I am using Delphi 2010.
there are a couple Delphi WMI components that allow remote access. I have not used the remote options personally though.
MagWmi - http://www.magsys.co.uk/delphi/magwmi.asp (Delphi 2010 support, and free with source)
WMISet/NTSet - http://www.online-admin.com/ntset.html (TNTShare
Manages shared resources on a local computer and remote hosts. Using this component you can change list of shared devices, see files that have been opened by remote users, watch and terminate remote sessions opened to the destination computer, change list of mapped network drives. It is not free.)
GLibWMI - Found at Torry.net, home page not available. (Delphi 2010 support and Freeware with source). Not sure if its capable of remote access. I have not used it.
Hope this helps
I think the same as Logman.
You can access this information using WMI.
GLibWMI components can be found on this website (http://neftali.clubdelphi.com) or sourceforge (http://sourceforge.net/projects/glibwmi/).
The current version is 1.8b and has a component called SharedInfo with which you can get that information.
The source code is available so you can expand it to access other WMI classes if necessary.
Regards.
P.D: Sorry for my mistakes with english.
You can enumerate shares using the NetShareEnum function (headers are in the Jedi Apilib).
I assume there must be an api for the "net use" but I have never used it (check the WNet functions). Alternative is to use the EnumNetworkDrives method of the WshNetwork com object.
As for netstat I don't think it's possible to do that remotely (other than using some kind of method to spawn a process remotely).

Resources