>If you only have one server
And if I don't? The question sure doesn't make that claim, so we can't make that assumption. Ok, maybe we could change the code to:
v = Shell(NET TIME \\<SERVERNAME> /SET /Y, vbHide)
But, whether we use this version or yours, this would:
a) have the nasty side effect of changing our workstation's time
b) not return the answer in a VB variable
If either a) or b) come in to effect then we haven't answered the original question, which specifically states: "We just want to capture the complete date and time on the server to a variable"
Sure, we could capture the workstation's current time and date, run your simple line of code, retrieve the new settings into VB variables through the Time and Date functions, and then set our system back to the original settings through another shell command (remembering to add on the time it took to actually run the code, if we're really fussy). Indeed, this might be an acceptable solution for the original questioner - but it sure as heck is no longno longer "a simple line of code"...
Alternatively, we could remove the /SET /Y, which solves a) - but we still fall foul of b), and need to develop a strategy for getting the time string the command returns into a VB variable. Again, this would no longer be "a simple line of code"...
The reason this site retains threads, has a search engine (and there is worked planned to improve it, as I'll grant it has limitations at the moment), and a FAQ repository is to allow us to refer back to them rather than typing in the same answers over and over again.