Below is the shell script to fetch username and other system details,
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
SN = objUser.SN
givenName = objUser.givenName
sAMAccountName = objUser.sAMAccountName
department = objUser.department
company = objUser.company
strTitle = "ComputerName" & objSysInfo.ComputerName
strDepartment = "DomainDNSName" & objSysInfo.DomainDNSName
strCompany = "DomainShortName" & objSysInfo.DomainShortName
strPhone = "ForestDNSName" & objSysInfo.ForestDNSName
strTitle1 = "IsNativeMode" & objSysInfo.IsNativeMode
strDepartment1 = "PDCRoleOwner" & objSysInfo.PDCRoleOwner
strCompany1 = "SchemaRoleOwner" & objSysInfo.SchemaRoleOwner
strPhone1 = "SiteName" & objSysInfo.SiteName
msgbox strName & strTitle & strDepartment & strCompany & strPhone & strTitle1 & strDepartment1 & strCompany1 & strPhone1 & SN & givenName & sAMAccountName & department & company
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
SN = objUser.SN
givenName = objUser.givenName
sAMAccountName = objUser.sAMAccountName
department = objUser.department
company = objUser.company
strTitle = "ComputerName" & objSysInfo.ComputerName
strDepartment = "DomainDNSName" & objSysInfo.DomainDNSName
strCompany = "DomainShortName" & objSysInfo.DomainShortName
strPhone = "ForestDNSName" & objSysInfo.ForestDNSName
strTitle1 = "IsNativeMode" & objSysInfo.IsNativeMode
strDepartment1 = "PDCRoleOwner" & objSysInfo.PDCRoleOwner
strCompany1 = "SchemaRoleOwner" & objSysInfo.SchemaRoleOwner
strPhone1 = "SiteName" & objSysInfo.SiteName
msgbox strName & strTitle & strDepartment & strCompany & strPhone & strTitle1 & strDepartment1 & strCompany1 & strPhone1 & SN & givenName & sAMAccountName & department & company