WScript
Hi,
can anybody help with some WScript as I am completely new to this.
I am working in an intranet environment and basically need to do the following:
1: Access the computer name of a user, who is calling an asp page
2: Get the active printer of that user and change it's settings
3: Print out an asp page with the new printer settings
can this be done?
I have played around a bit with WScript, but can't seem to get the computer name of the user (or it always returns the server name, where the asp script is run at) and when I try to run the following code I get the error message "Error Type:(0x80041003)", it errors on GetObject(), which I think means I don't have permission to do the following:
function TranslateDomainRole(byVal roleID)
Dim a
Select Case roleID
Case 0
a = "Standalone Workstation"
Case 1
a = "Member Workstation"
Case 2
a = "Standalone Server"
Case 3
a = "Member Server"
Case 4
a = "Backup Domain Controller"
Case 5
a = "Primary Domain Controller"
End Select
TranslateDomainRole = a
end function
Dim s, System, item
Set System = GetObject("winmgmts:").instancesOf("Win32_Computer System")
for each item in system'
s = "Computer Info" & vbcrlf
s = s & "***********************" & vbcrlf
s = s & "Name: " & item.name & vbcrlf
s = s & "Status: " & item.status & vbcrlf
s = s & "Type: " & item.SystemType & vbcrlf
s = s & "Mfg: " & item.Manufacturer & vbcrlf
s = s & "Model: " & item.Model & vbcrlf
s = s & "RAM: ~" & item.TotalPhysicalMemory\1024000 & "mb" & vbcrlf
s = s & "Domain: " & item.Domain & vbcrlf
s = s & "Role: " & TranslateDomainRole(item.DomainRole) & vbcrlf
s = s & "Current User: " & item.UserName & vbcrlf
wscript.echo s
next
any help is greatly appreciated...
|