find all users start menu "startup" folder


i'm writing scripts of our post-domain-join server builds (we build lot of servers) 

part of script have create shortcut batch file runs bginfo when user logs in...


how can find allusers startup folder?

 

i know on w7/2008 it's here:

c:\programdata\microsoft\windows\start menu\programs\startup

 

and on 2003 it's 

c:\documents , settings\all users\start menu\programs\startup

 

is there safer way find it, means of environment variable or fancy .net trick?

i need little more "universal"

 

here's did.

 

  $strallusersprofile = [io.path]::getfullpath($env:allusersprofile) $objshell = new-object -com "wscript.shell"  $objshortcut = $objshell.createshortcut($strallusersprofile + "\start menu\programs\startup\bginfo.lnk") $objshortcut.targetpath = "\\srv\applications\bginfo\bginfo.bat" $objshortcut.save()  



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group