Get user information, login name, machine version, etc

from System import Environment

print "Machine Name:\t", Environment.MachineName
print "User:\t\t", Environment.UserName
print "Domain:\t\t", Environment.UserDomainName
print "Drives:\t\t", Environment.GetLogicalDrives()
print "Directory:\t\t", Environment.SystemDirectory
print "OS:\t\t",Environment.OSVersion, " (64 bit)" if Environment.Is64BitOperatingSystem else " (32 bit)"
print "Spotfire Exe:\t", Environment.CommandLine, " (64 bits)" if Environment.Is64BitProcess else " (32 bits?)"
print "Special Path:\t",Environment.ExpandEnvironmentVariables("%SystemRoot%\\a\\b\\c")
print "Temp Directory:\t", Environment.GetEnvironmentVariable("TEMP")
print "System folder:\t", Environment.GetFolderPath(Environment.SpecialFolder.System)

#username from webplayer or client
from System.Threading import Thread

print(Thread.CurrentPrincipal.Identity.Name )

2 comments:

Anonymous said...

where we can show this information and how to show it

Leviaguirre said...

You could add these values in a document property and then use them as will, perhaps if you want to do some kind of authentication towards some kind of web service. This comes from the .NET environment. You can checkout the API from http://msdn.microsoft.com/en-us/library/system.environment.aspx