VBSCRIPT For a Copy a Folder

For a Copy a Folder Dim wShellstrComputer = “.”Set objWMIService = GetObject _ (“winmgmts:” & strComputer & “rootcimv2:Win32_Process”)‘errReturn = objWMIService.Create _ ‘ (“cmd.exe /c md c:ups”, Null, Null, intProcessID)Set objFSO = CreateObject(“Scripting.FileSystemObject”) objFSO.CopyFolder “file:// 2008*.*” , “c:pav” , OverwriteExisting Set wShell = CreateObject(“WScript.Shell”)‘wShell.Run “c:upsElection.html”Const OverwriteExisting = TRUE

Find the URLs of the currently running Internext Explorer Windows

' VBScript' Find the URLs of the currently running Internext Explorer Windows ' References:'  https://windowssdk.msdn.microsoft.com/en-us/library/ms630310.aspx'  https://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/objects/internetexplorer.asp Const IE_EXE = "iexplore.exe" Call FindCurrentURLs(strURLSet)WScript.Echo strURLSet wscript.quit(0) Function FindCurrentURLs(ByRef strURLSet) Dim objShell, objWindowSet, objWindow Dim strwindowName, strURL, strFullName  Set objShell = CreateObject("Shell.Application")    ' Create a Windows shell automation object Set objWindowSet = objShell.Windows      ' Get the collection of open windows belonging … Read more

Enumerating URLs in Internet Explorer

Enumerating URLs in Internet Explorer   # PowerShell $shell = new-object –com Shell.Application $windows = $shell.Windows() write-output ($windows.count.ToString() + " windows found") foreach ($window in $windows) {  if ($window.FullName -like "*iexplore*") {    write-output ($window.LocationURL + ", " + $window.LocationName)  }} $shell = $null ' VBScript' Find the URLs of the currently running Internext Explorer Windows … Read more

Active Directory Scripts

Active Directory Scriptinghttps://www.microsoft.com/technet/scriptcenter/guide/sas_ads_overview.mspx?mfr=true ——————————————————————————————– rem this code creates a user account with the common name MyerKen: Set objOU = GetObject("LDAP://ou=Management,dc=NA,dc=fabrikam,dc=com")Set objUser = objOU.Create("User", "cn=MyerKen") objUser.Put "sAMAccountName", "myerken"objUser.SetInfo Attribute Default Setting pwdLastSet User must change password at next logon userAccountControl Password Not Required userAccountControl Account Disabled ———————————————————————Setting a User Account Password Set objUser = GetObject _("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") … Read more

RoboCopy VBS Script

VBS script with source and destination folder input dialog boxes as well as hard coding the RoboCopy command line switches opposed to issuing the commands from the command prompt       Set objShell = CreateObject("Wscript.Shell")   objSource = InputBox("Enter Source") objDestination = InputBox("Enter Destination")   objCommand = "RoboCopy.Exe " & Chr(34) & objSource & … Read more