Has anyone come across an SLCM method that can capture the logged-in user's computer name or has anyone managed to develop a plug-in capable of doing just that?
var network = new ActiveXObject('WScript.Network'); // Show a pop up if it works alert(network.computerName);
Good Morning Muhammad Yusuf Khan. It seems impossible to retrieve the 'hostname' through a java script. As per your earlier findings. And also seen on 'the internet':var WshNetwork = new ActiveXObject( "WScript.Network" );var MachinName = WshNetwork.ComputerName; This won't work though for java script. Default browser security probably won't let you create the activex object. And, even if it did, that would get the computer name of the client, not the server.But like I said that probably won't work because of default browser security.There is no way to get the name of the webserver from the client. You can pass it to the client from the server, but other than that your kinda stuck. Thanks and kind regards, Louis.
How about something that executes\envokes a bat files that runs the 'hostname' command and returns the value into some variable?
However, I don't know how to code this. But I thought my thinking would help somewhat...
Thanks for your idea.
I just Googled to see if it was possible, which it is but it also leverages off the ActiveXObject that poses the same issue as just coding for the computer name:
I did however manage to find something else. If I were to code an SLCM plug-in in java, I would need to utilize code something like that of below:
System.getProperty("user.name"); //platform independent
java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();System.out.println("Hostname of local machine: " + localMachine.getHostName());
environment - Java current machine name and logged in user? - Stack Overflow
If there are any Java developers managing the SLCM application, who could do this. Please do and share
Plug-in would be executed on the server, not the client machine.
And honestly, you are not looking in the right direction if you want my opinion.
It this an enterprise Catalog?
If yes, this information should be provided by a discovery software (SCCM not to mention it) and populated in the CMDB.
You will then fetch the connected user's configuration items from the CMDB,
In regards to the below, I'm not actually looking for the computer name of the server, but rather of the client machine
This won't work though for java script. Default browser security probably won't let you create the activex object. And, even if it did, that would get the computer name of the client, not the server.
What's the probability once logging an idea for this, for this idea to be implemented?
I'm looking for functionality like $(_.user.id) but just for information pertaining to the client machine.
Good Afternoon Muhammad Yusuf Khan. Thanks for your reply and about opening an Idea.In general I'll say, yes please do. For "Nothing ventured, nothing gained." or "There’s no harm in trying". It is then up to the developers there after, to see whether this can be implemented. Thanks for your effort on this and I will definitely vote-up once created.Kind regards, Louis.