forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


@env(USERNAME) and Window7

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Thu Oct 25, 2012 8:43 am    Post subject: @env(USERNAME) and Window7 Reply with quote

Hi All

I've got a really annoying network admin problem. When I use
@env(USERNAME) remotely on Windows7 machines it returns nothing!
Is this some sort of security feature? We do have McAfee VirusScan
Enterprise 8.7.0i running on all machines could this be blocking the
info?

Thanks

David...
Back to top
View user's profile Send private message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Oct 25, 2012 4:08 pm    Post subject: Reply with quote

Interesting stuff.

Try
Code:
@env(userprofile)

please.

Let me know what happens.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Oct 25, 2012 4:13 pm    Post subject: Reply with quote

I think that should work, it appears to me on modern OS username is an elevated variable that returns SYSTEM. (This is just a quick once over)

USERPROFILE is a normal variable that should return something similar to 'C:\Users\Brandon'
Back to top
View user's profile Send private message AIM Address
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Mon Oct 29, 2012 3:04 pm    Post subject: Reply with quote

This seems to be a problem with winlogon on Window 7 machines.
I run my script from...

HLM\Software\Microsoft\Windows\CurrentVersion\Run

But the username environmental variable does not seem to be available
that early in the bootup sequence. I have tried a 60 second wait in the
script but I still can not get the username variable. I'm not sure if this is
still a security thing or I need to wait longer. I am going to try the
userprofile variable instead without a wait to see if that works.

Thanks

David..
Back to top
View user's profile Send private message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Mon Oct 29, 2012 9:56 pm    Post subject: Reply with quote

Have you tried

Code:
@env(userprofile)

yet?

Thanks,
Brandon
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Mon Oct 29, 2012 10:21 pm    Post subject: Reply with quote

Just in case @env(userprofile) NOT USERNAME doesn't work, here's a craptastic little workaround I hacked together for fun in vbscript

Code:

Dim objNetwork
Dim userName
Dim sFilePath
Dim objFSO, newfolder 'As FileSystemObject
Dim objTextFile 'As Object
   
    Const ForReading = 1
    Const ForWriting = 2
    Const ForAppending = 8

sFilePath = "C:\Temp\User.txt"

Set objNetwork = CreateObject("WScript.Network")

    Set objFSO = CreateObject("Scripting.FileSystemObject")
userName = objNetwork.UserName
 
'WScript.Echo userName

If objFSO.FileExists (sFilePath) then
objFSO.DeleteFile sFilePath
End If

If Not objFSO.FolderExists("C:\Temp") Then
   objFSO.CreateFolder "C:\Temp"
End If

    Set objTextFile = objFSO.CreateTextFile(sFilePath, True)

    ' Write a line.
    objTextFile.Write (userName)

    objTextFile.Close
    'objTextFile.Close


Then in vds
Code:

list create,1
list loadfile,1,c:\temp\user.txt
list seek,1,0
info @item(1)
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group