Client Management Suite

 View Only

Wise Script to Map a Network Folder 

Dec 19, 2008 11:26 AM

If you are planning to map a network folder as a drive using Wise script, attached is the Wise script that can do the task for you.

You have to define two variables in this sample script.

  1. Network folder full path

    SHARE_FOLDER [\\SERVER_NAME\SHARE_NAME]

  2. Drive letter

    DRIVE_LETTER[W:]

License:AJSL
By clicking the download link below, you agree to the terms and conditions in the Altiris Juice Software License
Support:User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.

Statistics
0 Favorited
0 Views
2 Files
0 Shares
0 Downloads
Attachment(s)
jpg file
6639.jpg   2 KB   1 version
Uploaded - Feb 25, 2020
zip file
Map_Drive.zip   957 B   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Sep 07, 2010 09:56 AM

Yeah good one but it is not advisable to map a network drive in the msi ..

Aug 18, 2010 02:24 PM

We often find it useful to map the %INST% directory (either a network drive or another folder) as the first available drive letter to reduce the character count in a command line. Here's the code to copy and paste into a blank WiseScript .WSE :
item: Remark
  Text=***   Map the installation source as the first free drive letter
end
item: Set Variable
  Variable=SP_INST
  Value=%INST%
  Flags=00010100
end
item: Set Variable
  Variable=DRIVELETTERS
  Value=GHIJKLMNOPQRSTUVWXYZ
end
item: Set Variable
  Variable=ICOUNTER
  Value=1
end
item: Set Variable
  Variable=IMAX
  Value=20
end
item: Set Variable
  Variable=DRIVE_LTR
  Value=NOTHING
end
item: If/While Statement
  Value=ICounter <= IMAX
  Flags=00011101
end
item: Set Variable
  Variable=CDRIVE
  Value=Mid$(DRIVELETTERS,iCounter,1)
  Flags=00100000
end
item: Get System Information
  Variable=DRIVETYPE
  Pathname=%CDRIVE%
  Flags=00001000
end
item: If/While Statement
  Variable=DRIVETYPE
end
item: Set Variable
  Variable=DRIVE_LTR
  Value=%CDRIVE%
end
item: Set Variable
  Variable=ICOUNTER
  Value=100
end
item: End Block
end
item: Set Variable
  Variable=ICOUNTER
  Value=%ICOUNTER%
  Flags=00000100
end
item: End Block
end
item: Remark
end
item: If/While Statement
  Variable=OS
  Value=2000
end
item: If/While Statement
  Variable=SP_INST
  Value=\\
  Flags=00000010
end
item: Execute Program
  Pathname=%SYS32%\cmd.exe
  Command Line=/c "net use %DRIVE_LTR%: %SP_INST%"
  Flags=00001010
end
item: Else Statement
end
item: Execute Program
  Pathname=subst.exe
  Command Line=%DRIVE_LTR%: %SP_INST%
  Flags=00001010
end
item: End Block
end
item: Else Statement
end
item: Parse String
  Source=%SP_INST%
  Pattern=1
  Variable1=CHECKVAL
  Variable2=JUNK
  Flags=00001100
end
item: If/While Statement
  Variable=CHECKVAL
  Value=:
  Flags=00000100
end
item: Execute Program
  Pathname=subst.exe
  Command Line=%DRIVE_LTR%: %SP_INST%\
  Flags=00001010
end
item: Else Statement
end
item: Execute Program
  Pathname=subst.exe
  Command Line=%DRIVE_LTR%: %SP_INST%
  Flags=00001010
end
item: Custom Script Item
  Filename=- NG Execute Program.wse
  Variable Name1=_NGEXE_EXE_
  Variable Value1=subst.exe
  Variable Name2=_NGEXE_WINDSIZE_
  Variable Value2=Hidden
  Variable Name3=_NGEXE_COMMENT_
  Variable Value3=Mapping installation directory as %DRIVE_LTR%:\ drive
  Variable Name4=_NGEXE_WAIT_
  Variable Value4=A
  Variable Name5=_NGEXE_CMDLINE_
  Variable Value5=%DRIVE_LTR%: %SP_INST%
  Variable Name6=_NGEXE_DEFDIR_
end
item: End Block
end
item: End Block
end

Dec 22, 2008 11:24 PM

net use w: \\Server\Share

Dec 21, 2008 11:39 AM

Dim objNetwork, strDrive, objShell
Dim strRemotePath, strDriveLetter, strNewName
strDriveLetter = "F:"
strRemotePath = "\\MyServer\Myfolder"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

Related Entries and Links

No Related Resource entered.