Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Shortcut on desktop via logon?

HTVi
TV Discussion Newsgroups

Shortcut on desktop via logon?
"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> 10/2/2008 8:59:21 PM
Hi,

I've been asked to distribute a shortcut to a web site to all my users. I
think the best way to do this is through the logon.bat file, however, I'm
stuck, can't seem to figure it out. It seemed simple enough, just add the
following code to my batch file, right?

If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
%ALLUSERSPROFILE%\Desktop)

Of course this doesn't work. Can someone show me how to handle this in the
simplest way possible? I've been Googling the solution and I'm not finding
anything useful, just confusing.

The PI.lnk file is currently located in the DC Netlogon directory.

As a test I modified the line to look like this below and put a test.txt
file on the All Users Desktop on my test system.

If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not there!")
Else (Echo "It's there!")

From this line I get no response in my batch file output. I'm clearly
missing something fundamental here. Any thoughts, words of wisdom?

Thanks in advance,
Linn


Re: Shortcut on desktop via logon?
"Pegasus \(MVP\)" <I.can[ at ]fly.com.oz> 10/2/2008 9:31:49 PM

"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Hi,
>
> I've been asked to distribute a shortcut to a web site to all my users. I
> think the best way to do this is through the logon.bat file, however, I'm
> stuck, can't seem to figure it out. It seemed simple enough, just add the
> following code to my batch file, right?
>
> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
> %ALLUSERSPROFILE%\Desktop)
>
> Of course this doesn't work. Can someone show me how to handle this in
> the simplest way possible? I've been Googling the solution and I'm not
> finding anything useful, just confusing.
>
> The PI.lnk file is currently located in the DC Netlogon directory.
>
> As a test I modified the line to look like this below and put a test.txt
> file on the All Users Desktop on my test system.
>
> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not there!")
> Else (Echo "It's there!")
>
> From this line I get no response in my batch file output. I'm clearly
> missing something fundamental here. Any thoughts, words of wisdom?
>
> Thanks in advance,
> Linn
>

Since the string
%ALLUSERSPROFILE%\Desktop\PI.lnk
contains embedded spaces when resolved, you must surround the whole lot with
double quotes:
"%ALLUSERSPROFILE%\Desktop\PI.lnk"
You must also provide the full path (share + folder name) for your source
file pi.lnk.


Re: Shortcut on desktop via logon?
"Pegasus \(MVP\)" <I.can[ at ]fly.com.oz> 10/2/2008 9:33:32 PM

"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Hi,
>
> I've been asked to distribute a shortcut to a web site to all my users. I
> think the best way to do this is through the logon.bat file, however, I'm
> stuck, can't seem to figure it out. It seemed simple enough, just add the
> following code to my batch file, right?
>
> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
> %ALLUSERSPROFILE%\Desktop)
>
> Of course this doesn't work. Can someone show me how to handle this in
> the simplest way possible? I've been Googling the solution and I'm not
> finding anything useful, just confusing.
>
> The PI.lnk file is currently located in the DC Netlogon directory.
>
> As a test I modified the line to look like this below and put a test.txt
> file on the All Users Desktop on my test system.
>
> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not there!")
> Else (Echo "It's there!")
>
> From this line I get no response in my batch file output. I'm clearly
> missing something fundamental here. Any thoughts, words of wisdom?
>
> Thanks in advance,
> Linn
>

At second thoughts: Instead of writing "if not exist . . .", use xcopy.exe
with the /d switch. This method will copy the file if it does not exist but
also if the source file is newer than the target file.


Re: Shortcut on desktop via logon?
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 10/3/2008 3:53:53 AM

"Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
news:OXfTGaNJJHA.5356[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>
> "Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
> news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
>> Hi,
>>
>> I've been asked to distribute a shortcut to a web site to all my users.
>> I think the best way to do this is through the logon.bat file, however,
>> I'm stuck, can't seem to figure it out. It seemed simple enough, just
>> add the following code to my batch file, right?
>>
>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>> %ALLUSERSPROFILE%\Desktop)
>>
>> Of course this doesn't work. Can someone show me how to handle this in
>> the simplest way possible? I've been Googling the solution and I'm not
>> finding anything useful, just confusing.
>>
>> The PI.lnk file is currently located in the DC Netlogon directory.
>>
>> As a test I modified the line to look like this below and put a test.txt
>> file on the All Users Desktop on my test system.
>>
>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not there!")
>> Else (Echo "It's there!")
>>
>> From this line I get no response in my batch file output. I'm clearly
>> missing something fundamental here. Any thoughts, words of wisdom?
>>
>> Thanks in advance,
>> Linn
>>
>
> At second thoughts: Instead of writing "if not exist . . .", use xcopy.exe
> with the /d switch. This method will copy the file if it does not exist
> but also if the source file is newer than the target file.

And finally - all of your users administrators or power users on the
workstations? If not, the script will be unable to succeed as the logon
script runs under the user's credentials.

Personally, I'd find it more straightforward to push the file out to all the
workstations while logged in to an account that is an admin on all the
workstations with something like this:

for /f %%C in (complist.txt) do (
copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
)

where the complist.txt file contains a list of the computers to be updated.

/Al


Re: Shortcut on desktop via logon?
"Pegasus \(MVP\)" <I.can[ at ]fly.com.oz> 10/3/2008 6:30:24 AM

"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
news:et59ouQJJHA.740[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
>
> "Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
> news:OXfTGaNJJHA.5356[ at ]TK2MSFTNGP05.phx.gbl...
>>
>> "Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
>> news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
>>> Hi,
>>>
>>> I've been asked to distribute a shortcut to a web site to all my users.
>>> I think the best way to do this is through the logon.bat file, however,
>>> I'm stuck, can't seem to figure it out. It seemed simple enough, just
>>> add the following code to my batch file, right?
>>>
>>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>>> %ALLUSERSPROFILE%\Desktop)
>>>
>>> Of course this doesn't work. Can someone show me how to handle this in
>>> the simplest way possible? I've been Googling the solution and I'm not
>>> finding anything useful, just confusing.
>>>
>>> The PI.lnk file is currently located in the DC Netlogon directory.
>>>
>>> As a test I modified the line to look like this below and put a test.txt
>>> file on the All Users Desktop on my test system.
>>>
>>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not there!")
>>> Else (Echo "It's there!")
>>>
>>> From this line I get no response in my batch file output. I'm clearly
>>> missing something fundamental here. Any thoughts, words of wisdom?
>>>
>>> Thanks in advance,
>>> Linn
>>>
>>
>> At second thoughts: Instead of writing "if not exist . . .", use
>> xcopy.exe with the /d switch. This method will copy the file if it does
>> not exist but also if the source file is newer than the target file.
>
> And finally - all of your users administrators or power users on the
> workstations? If not, the script will be unable to succeed as the logon
> script runs under the user's credentials.
>
> Personally, I'd find it more straightforward to push the file out to all
> the workstations while logged in to an account that is an admin on all the
> workstations with something like this:
>
> for /f %%C in (complist.txt) do (
> copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
> )
>
> where the complist.txt file contains a list of the computers to be
> updated.
>
> /Al
>

Didn't you forget a set of double-quotes there? And perhaps a /y switch in
order to avoid repeated "overwrite" prompts?


Re: Shortcut on desktop via logon?
"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> 10/3/2008 1:33:26 PM

"Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
news:eak4FGSJJHA.4672[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>
> "Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
> news:et59ouQJJHA.740[ at ]TK2MSFTNGP03.phx.gbl...
>>
>> "Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
>> news:OXfTGaNJJHA.5356[ at ]TK2MSFTNGP05.phx.gbl...
>>>
>>> "Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
>>> news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
>>>> Hi,
>>>>
>>>> I've been asked to distribute a shortcut to a web site to all my users.
>>>> I think the best way to do this is through the logon.bat file, however,
>>>> I'm stuck, can't seem to figure it out. It seemed simple enough, just
>>>> add the following code to my batch file, right?
>>>>
>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>>>> %ALLUSERSPROFILE%\Desktop)
>>>>
>>>> Of course this doesn't work. Can someone show me how to handle this in
>>>> the simplest way possible? I've been Googling the solution and I'm not
>>>> finding anything useful, just confusing.
>>>>
>>>> The PI.lnk file is currently located in the DC Netlogon directory.
>>>>
>>>> As a test I modified the line to look like this below and put a
>>>> test.txt file on the All Users Desktop on my test system.
>>>>
>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not
>>>> there!") Else (Echo "It's there!")
>>>>
>>>> From this line I get no response in my batch file output. I'm clearly
>>>> missing something fundamental here. Any thoughts, words of wisdom?
>>>>
>>>> Thanks in advance,
>>>> Linn
>>>>
>>>
>>> At second thoughts: Instead of writing "if not exist . . .", use
>>> xcopy.exe with the /d switch. This method will copy the file if it does
>>> not exist but also if the source file is newer than the target file.
>>
>> And finally - all of your users administrators or power users on the
>> workstations? If not, the script will be unable to succeed as the logon
>> script runs under the user's credentials.
>>
>> Personally, I'd find it more straightforward to push the file out to all
>> the workstations while logged in to an account that is an admin on all
>> the workstations with something like this:
>>
>> for /f %%C in (complist.txt) do (
>> copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
>> )
>>
>> where the complist.txt file contains a list of the computers to be
>> updated.
>>
>> /Al
>>
>
> Didn't you forget a set of double-quotes there? And perhaps a /y switch in
> order to avoid repeated "overwrite" prompts?

Thanks guys for the suggestions, I like this method for it's simplicity.
I've never had to do so much with batch files that I needed learned all
these tricks. Hard part here will be creating the complist.txt of computer
names and making sure they are all on.

It did occure to me last night that I don't need it in the logon script. If
I put the shortcut on the all users desktop then most users won't be able to
delete it and it should remain there. Let me give this a try.

Thanks,
Linn


Re: Shortcut on desktop via logon?
"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> 10/3/2008 5:04:05 PM

"Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
news:eak4FGSJJHA.4672[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>
> "Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
> news:et59ouQJJHA.740[ at ]TK2MSFTNGP03.phx.gbl...
>>
>> "Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
>> news:OXfTGaNJJHA.5356[ at ]TK2MSFTNGP05.phx.gbl...
>>>
>>> "Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
>>> news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
>>>> Hi,
>>>>
>>>> I've been asked to distribute a shortcut to a web site to all my users.
>>>> I think the best way to do this is through the logon.bat file, however,
>>>> I'm stuck, can't seem to figure it out. It seemed simple enough, just
>>>> add the following code to my batch file, right?
>>>>
>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>>>> %ALLUSERSPROFILE%\Desktop)
>>>>
>>>> Of course this doesn't work. Can someone show me how to handle this in
>>>> the simplest way possible? I've been Googling the solution and I'm not
>>>> finding anything useful, just confusing.
>>>>
>>>> The PI.lnk file is currently located in the DC Netlogon directory.
>>>>
>>>> As a test I modified the line to look like this below and put a
>>>> test.txt file on the All Users Desktop on my test system.
>>>>
>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not
>>>> there!") Else (Echo "It's there!")
>>>>
>>>> From this line I get no response in my batch file output. I'm clearly
>>>> missing something fundamental here. Any thoughts, words of wisdom?
>>>>
>>>> Thanks in advance,
>>>> Linn
>>>>
>>>
>>> At second thoughts: Instead of writing "if not exist . . .", use
>>> xcopy.exe with the /d switch. This method will copy the file if it does
>>> not exist but also if the source file is newer than the target file.
>>
>> And finally - all of your users administrators or power users on the
>> workstations? If not, the script will be unable to succeed as the logon
>> script runs under the user's credentials.
>>
>> Personally, I'd find it more straightforward to push the file out to all
>> the workstations while logged in to an account that is an admin on all
>> the workstations with something like this:
>>
>> for /f %%C in (complist.txt) do (
>> copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
>> )
>>
>> where the complist.txt file contains a list of the computers to be
>> updated.
>>
>> /Al
>>
>
> Didn't you forget a set of double-quotes there? And perhaps a /y switch in
> order to avoid repeated "overwrite" prompts?

Say, if I wanted to output the computer name and the result of the copy to a
log file, how would I display the computer name?

I tried adding the line; Echo %%c >> mylog.log but it just records %c.

Thanks,
Linn


Re: Shortcut on desktop via logon?
"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> 10/3/2008 5:16:59 PM

"Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
news:%23OTKLoXJJHA.4996[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
>
> "Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
> news:eak4FGSJJHA.4672[ at ]TK2MSFTNGP05.phx.gbl...
>>
>> "Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
>> news:et59ouQJJHA.740[ at ]TK2MSFTNGP03.phx.gbl...
>>>
>>> "Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
>>> news:OXfTGaNJJHA.5356[ at ]TK2MSFTNGP05.phx.gbl...
>>>>
>>>> "Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
>>>> news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
>>>>> Hi,
>>>>>
>>>>> I've been asked to distribute a shortcut to a web site to all my
>>>>> users. I think the best way to do this is through the logon.bat file,
>>>>> however, I'm stuck, can't seem to figure it out. It seemed simple
>>>>> enough, just add the following code to my batch file, right?
>>>>>
>>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>>>>> %ALLUSERSPROFILE%\Desktop)
>>>>>
>>>>> Of course this doesn't work. Can someone show me how to handle this
>>>>> in the simplest way possible? I've been Googling the solution and I'm
>>>>> not finding anything useful, just confusing.
>>>>>
>>>>> The PI.lnk file is currently located in the DC Netlogon directory.
>>>>>
>>>>> As a test I modified the line to look like this below and put a
>>>>> test.txt file on the All Users Desktop on my test system.
>>>>>
>>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not
>>>>> there!") Else (Echo "It's there!")
>>>>>
>>>>> From this line I get no response in my batch file output. I'm clearly
>>>>> missing something fundamental here. Any thoughts, words of wisdom?
>>>>>
>>>>> Thanks in advance,
>>>>> Linn
>>>>>
>>>>
>>>> At second thoughts: Instead of writing "if not exist . . .", use
>>>> xcopy.exe with the /d switch. This method will copy the file if it does
>>>> not exist but also if the source file is newer than the target file.
>>>
>>> And finally - all of your users administrators or power users on the
>>> workstations? If not, the script will be unable to succeed as the logon
>>> script runs under the user's credentials.
>>>
>>> Personally, I'd find it more straightforward to push the file out to all
>>> the workstations while logged in to an account that is an admin on all
>>> the workstations with something like this:
>>>
>>> for /f %%C in (complist.txt) do (
>>> copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
>>> )
>>>
>>> where the complist.txt file contains a list of the computers to be
>>> updated.
>>>
>>> /Al
>>>
>>
>> Didn't you forget a set of double-quotes there? And perhaps a /y switch
>> in order to avoid repeated "overwrite" prompts?
>
> Say, if I wanted to output the computer name and the result of the copy to
> a log file, how would I display the computer name?
>
> I tried adding the line; Echo %%c >> mylog.log but it just records %c.
>
> Thanks,
> Linn
Oops, never mind. I just realized it's case sensitive.
Linn


Re: Shortcut on desktop via logon?
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 10/7/2008 12:22:06 AM

"Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
news:eak4FGSJJHA.4672[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>
> "Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
> news:et59ouQJJHA.740[ at ]TK2MSFTNGP03.phx.gbl...
>>
>> "Pegasus (MVP)" <I.can[ at ]fly.com.oz> wrote in message
>> news:OXfTGaNJJHA.5356[ at ]TK2MSFTNGP05.phx.gbl...
>>>
>>> "Linn Kubler" <lkubler[ at ]chartwellwisc2.com> wrote in message
>>> news:OzCi$GNJJHA.4280[ at ]TK2MSFTNGP04.phx.gbl...
>>>> Hi,
>>>>
>>>> I've been asked to distribute a shortcut to a web site to all my users.
>>>> I think the best way to do this is through the logon.bat file, however,
>>>> I'm stuck, can't seem to figure it out. It seemed simple enough, just
>>>> add the following code to my batch file, right?
>>>>
>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>>>> %ALLUSERSPROFILE%\Desktop)
>>>>
>>>> Of course this doesn't work. Can someone show me how to handle this in
>>>> the simplest way possible? I've been Googling the solution and I'm not
>>>> finding anything useful, just confusing.
>>>>
>>>> The PI.lnk file is currently located in the DC Netlogon directory.
>>>>
>>>> As a test I modified the line to look like this below and put a
>>>> test.txt file on the All Users Desktop on my test system.
>>>>
>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not
>>>> there!") Else (Echo "It's there!")
>>>>
>>>> From this line I get no response in my batch file output. I'm clearly
>>>> missing something fundamental here. Any thoughts, words of wisdom?
>>>>
>>>> Thanks in advance,
>>>> Linn
>>>>
>>>
>>> At second thoughts: Instead of writing "if not exist . . .", use
>>> xcopy.exe with the /d switch. This method will copy the file if it does
>>> not exist but also if the source file is newer than the target file.
>>
>> And finally - all of your users administrators or power users on the
>> workstations? If not, the script will be unable to succeed as the logon
>> script runs under the user's credentials.
>>
>> Personally, I'd find it more straightforward to push the file out to all
>> the workstations while logged in to an account that is an admin on all
>> the workstations with something like this:
>>
>> for /f %%C in (complist.txt) do (
>> copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
>> )
>>
>> where the complist.txt file contains a list of the computers to be
>> updated.
>>
>> /Al
>>
>
> Didn't you forget a set of double-quotes there? And perhaps a /y switch in
> order to avoid repeated "overwrite" prompts?

I was in a hurry. But I didn't say "use this", I said that "I find it more
straightforward ... with something _LIKE_ this".

/Al


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen