Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim varToday, Verify, LastRunDate
Dim strLocalfile
Dim newfolder, newfolderpath
Dim strCurrentFolder
Dim objFSO:Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim WshShell:Set WshShell = WScript.CreateObject("WScript.Shell")
Dim WshEnv:Set WshEnv = WshShell.Environment("Process")
SysDrive = WshEnv("%SYSTEMDRIVE%")
SysRoot = WshEnv("SYSTEMROOT")
LogonSvr = WshEnv("LOGONSERVER")
strDsk = WshShell.SpecialFolders("Desktop")
strMyDocuments = WshShell.SpecialFolders("MyDocuments")
Const OverwriteExisting = True
'-------------------------------------------------------------------------------------------------------------------------
'Do not run on these machines (list of servers)
Set objNetwork = CreateObject("WScript.Network")
thisComputer = objNetwork.ComputerName
arrComputers = Array("Computer","Server","Server","Computer")
For Each arrayElement in arrComputers
if arrayElement = thisComputer then
wscript.Quit
end if
next
'----------------------------------------------------------------------------------------------------------------------------
'Check if this is a Server. If this is a server quit
'We don't want to delete any scheduled jobs on servers
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
If InStr(1,objItem.Caption,"Server") Then Wscript.Quit
Next
'----------------------------------------------------------------------------------------------------------------------------
'Now Create a registry value so if this script has run it wont run again today
varToday = Anyname
varToday = Weekday(Date)
Verify = "HKLM\SOFTWARE\MyInstallsAndFixes\"
'Check if scan has run today and if so exit
On Error Resume Next
LastRunDate = WshShell.RegRead(Verify & "Cleanmgr")
If LastRunDate = cstr(Date) Then
WScript.Quit
Else
WshShell.RegWrite Verify & "AnyName",Date,"REG_SZ"
End If
On Error Goto 0
'----------------------------------------------------------------------------------------------------------------------------
'CreateNewFolder
newfolderpath = strDsk & "\MyProgs"
If Not objFSO.FolderExists(newfolderpath) Then
Set newfolder = objFSO.CreateFolder(newfolderpath)
End If
'----------------------------------------------------------------------------------------------------------------------------
'Now copy the encoded script file to users machine
strLocalfile = strDsk & "\somefilename"
If objFSO.FileExists(strLocalfile)=false Then
objFSO.CopyFile "\\Server\Share$\somefile.txt" , strDsk , OverwriteExisting = true
end if
'----------------------------------------------------------------------------------------------------------------------------