PS script for shortcut
I wrote a script in Wscript but , new to PS. Please can some one guide me. The Script should look at AD and if present look in which location its added and then create shortcut for that location
set Variable GrpName to
Parse String "%grpname%" into GRP and LCTN
set Variable GRP to %GRP%
set variable LCTN to %LCTN%
set variable PRF to C:\Program Files (x86)
set variable XYZ to %PRF%\ABC\DEF
set config to \\srvrlocatn
set config to %config%\Lctn
set config1 to \\inilocatn
Read ini value from %config%IPA.ini into variable IPA
Get Environmental Variable PROGRAMDATA into Variable PROGRAMDATA
set Variable IEXPLORER to C:\program files (x86)\Interenet Explorer\iexplore.exe
If LCTN Equals "NYC" then
create shortcut from %IEXPLORER% to %programdata%\ABCshortcut_NYC
Thank you
Answers (1)
Top Answer
$DestinationPath = 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Blah IE.lnk'
$ArgumentsToSourceExe = 'http://blah.com'
$Shortcut = $WshShell.CreateShortcut($DestinationPath)
$Shortcut.TargetPath = $SourceExe
$Shortcut.Arguments = $ArgumentsToSourceExe
$Shortcut.Save()
This will get you kicking just replace FQDN with your FQDN and see how that goes for a starter.
All this does is looks at the WMI of the system and pulls information stored there.
get-wmiobject win32_ntdomain | Where-Object -FilterScript {$_.DNSForestName -eq 'FQDN'} | select *
If this has the information you want we can then narrow it down to a single item and make it into a variable based on the word. - Rob_Cliffeild 8 years ago