├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Explorer Settings ├── README.md ├── add template.vbs ├── command prompt menu here.vbs ├── environmental variables.vbs ├── list administrative tools.vbs ├── list desktop settings.vbs ├── list shortcuts.vbs ├── list start menu items.vbs ├── list start menu program groups.vbs ├── path to pictures.vbs ├── rename my computer icon.vbs └── verify local scripting environment.vbs ├── Group Policy ├── README.md ├── group policy links.vbs ├── group policy settings.vbs ├── policy administrative template files.vbs ├── policy audit policies.vbs ├── policy gpos.vbs ├── policy group policy extension status.vbs ├── policy scopes.vbs ├── policy security even log boolean.vbs ├── policy security event log numberic.vbs ├── policy security settings boolean.vbs ├── policy security settings numeric.vbs ├── policy system services.vbs ├── rsop application management.vbs ├── rsop sessions.vbs └── user privelege rights.vbs ├── Hardware and Firmware ├── README.md ├── chassis type.vbs ├── computer baseboard properties.vbs ├── computer bus properties.vbs ├── computer fan info.vbs ├── enumerate onboard devices.vbs ├── enumerate processor info.vbs ├── enumerating irq settings.vbs ├── identifying processor type.vbs ├── motherboard device info.vbs ├── retreive bios info.vbs └── smbios info.vbs ├── Internet Explorer ├── Add Sites to an Internet Explorer Security Zone.vbs ├── Add a Web Site to the Favorites Menu.vbs ├── Delete a Site from an Internet Explorer Security Zone.vbs ├── Delete an Allowed Protocol from an Internet Explorer Security Zone Site.vbs ├── List Internet Explorer Connection Summary Information.vbs ├── List Audited Internet Explorer Events from the Security Log.vbs ├── List Internet Explorer COM Object Settings.vbs ├── List Internet Explorer Cache Settings.vbs ├── List Internet Explorer Connection Settings.vbs ├── List Internet Explorer File Version Information.vbs ├── List Internet Explorer LAN Settings.vbs ├── List Internet Explorer Security Setting Values.vbs ├── List Internet Explorer Security Zone Settings.vbs ├── List Internet Explorer Summary Settings.vbs ├── List Items in the Internet Cookies Folder.vbs ├── List Items in the Internet Favorites Folder.vbs ├── List Items in the Temporary Internet Files Folder.vbs ├── List Sites in Internet Explorer Security Zones.vbs ├── List the Items in the Internet Explorer History Folder.vbs ├── List the Path to the Internet Explorer Folder.vbs ├── Modify Advanced Internet Explorer Settings.vbs ├── Modify Internet Explorer Advanced Settings.vbs ├── Modify Internet Explorer Security Settings.vbs ├── Monitor Internet Explorer Security Changes.vbs ├── Verify Internet Explorer Enhanced Security Configuration Status.vbs └── Verify Whether Internet Explorer Enhanced Security is Enabled for the Logged-on User.vbs ├── Internet Information Server ├── IIS 5 │ └── README.md ├── IIS 6 │ └── README.md ├── README.md └── parse iis logs.vbs ├── LICENSE ├── Logon Sessions ├── README.md ├── list logon session info.vbs ├── user passport info.vbs └── users on remote computers.vbs ├── Logs ├── Event Logs │ ├── README.md │ ├── add wmi data to event log.vbs │ ├── all stop events.vbs │ ├── backup and clear eventlog.vbs │ ├── backup and clear large event logs.vbs │ ├── copy event log events to database.vbs │ ├── copy previous days event logs to database.vbs │ ├── copy prior days event logs to database.vbs │ ├── custom event log.vbs │ ├── event log properties.vbs │ ├── events from log.vbs │ ├── events using asynchronous query.vbs │ ├── list events from specific day.vbs │ ├── list events from specific event log.vbs │ ├── list system event log properties.vbs │ ├── modify event log properties.vbs │ ├── monitor event logs in real time.vbs │ ├── security log properties.vbs │ ├── specific events from event log.vbs │ ├── unique file name generator.vbs │ ├── write events to local event log.vbs │ ├── write events to remote event log.vbs │ └── wrtie to custom event log.vbs ├── Plaintext Logs │ ├── README.md │ ├── read comma seperated value log.vbs │ └── read fixed width column log.vbs └── README.md ├── Mathematics ├── README.md ├── arithmetic.vbs ├── calculation.vbs ├── spiral of theodorus SVG.vbs └── spiral of theodorus.vbs ├── Memory ├── README.md ├── dma channel info.vbs ├── list cache memory info.vbs ├── list device memory address.vbs ├── list memory information ├── memory devices.vbs ├── physical memory config.vbs └── physical memory properties.vbs ├── Microsoft Exchange Server ├── README.md ├── cluster resource info.vbs ├── connector state.vbs ├── domain controller info.vbs ├── exchange link info.vbs ├── exchange logon info.vbs ├── exchange public folder info.vbs ├── exchange schedule interval info.vbs ├── exchange server info.vbs ├── exchange xml queue data.vbs ├── folder tree.vbs ├── list exchange queue info.vbs ├── mailbox info.vbs ├── message tracking entry info.vbs ├── queue cached reload time.vbs ├── queued message info.vbs ├── server state info.vbs └── virtual server queue info.vbs ├── Microsoft Office ├── Excel │ ├── README.md │ ├── active directory data.vbs │ ├── add data to cell.vbs │ ├── autofit columns.vbs │ ├── autoformat to spreadsheet.vbs │ ├── create user accounts.vbs │ ├── format range of cells.vbs │ ├── formatted data.vbs │ ├── list active directory data.vbs │ ├── list excel color values.vbs │ ├── list service data.vbs │ ├── open spreadsheet.vbs │ ├── read spreadsheet.vbs │ ├── sort excel spreadsheet.vbs │ └── sort worksheet.vbs ├── Powerpoint │ ├── README.md │ ├── add slide to pptx.vbs │ ├── modify bulleted list in pptx.vbs │ ├── run pptx slide show.vbs │ ├── sample pptx.vbs │ ├── shape found on pptx.vbs │ └── shapes found on pptx slide.vbs ├── README.md └── Word │ ├── README.md │ ├── add formatted text.vbs │ ├── add table to doc.vbs │ ├── append text.vbs │ ├── bookmarks.vbs │ ├── create and save.vbs │ ├── create doc.vbs │ ├── file search.vbs │ ├── format paragraphs.vbs │ ├── formatted table.vbs │ ├── list word properties.vbs │ ├── modify bookmark text.vbs │ ├── picture to word doc.vbs │ ├── print.vbs │ ├── quit without saving.vbs │ ├── service information.vbs │ ├── style table.vbs │ ├── word doc to html.vbs │ └── word version.vbs ├── Monitoring Hardware ├── README.md ├── available memory.vbs ├── cache performance.vbs ├── changes in computer power status.vbs ├── memory performance.vbs ├── processor performance.vbs ├── processor use.vbs ├── verify computer availability.vbs └── verify system uptime.vbs ├── Other ├── CalFileSize.vbs ├── CalcDiffTime.vbs ├── ChkFreeSize.vbs ├── FWMLParser.vbs ├── GenBiosReadBackScript.vbs ├── GetCurrentTime.vbs ├── HideCMD.vbs ├── HideEXE.vbs ├── IIsExt.vbs ├── Lhidecmd.vbs ├── RWINI.VBS ├── ReturnFile.vbs ├── RevFile.vbs ├── RunCmd.vbs ├── SafeMode.vbs ├── SafeModeCommandPrompt.vbs ├── SafeModeNetworking.vbs ├── SafeModeNormalMode.vbs ├── SyncAppvPublishingServer.vbs ├── WallpaperPath.vbs ├── WiCompon.vbs ├── XMLPARSER.VBS ├── _sleep.vbs ├── adsutil.vbs ├── debugTest.vbs ├── empty.vbs ├── gatherNetworkInfo.vbs ├── getdisksize.vbs ├── getimginfo.vbs ├── green.vbs ├── instupd.vbs ├── paste.vbs ├── prncnfg.vbs ├── prndrvr.vbs ├── prnjobs.vbs ├── prnmngr.vbs ├── prnport.vbs ├── prnqctl.vbs ├── pubprn.vbs ├── register_app.vbs ├── rwinidq.vbs ├── shutdown.vbs ├── sizecol.vbs ├── slmgr.vbs ├── testDictionary.vbs ├── testInterp.vbs ├── widialog.vbs ├── widiffdb.vbs ├── wiexport.vbs ├── wifeatur.vbs ├── wifilver.vbs ├── wigenxfm.vbs ├── wiimport.vbs ├── wilangid.vbs ├── wilstprd.vbs ├── wilstscr.vbs ├── wilstxfm.vbs ├── wimakcab.vbs ├── wimerge.vbs ├── winrm.vbs ├── wipolicy.vbs ├── wirunsql.vbs ├── wistream.vbs ├── wisubstg.vbs ├── wisuminf.vbs ├── witextin.vbs ├── witoansi.vbs └── wiusexfm.vbs ├── Peripherals and Devices ├── README.md ├── list keyboard properties.vbs ├── modem info.vbs ├── plug and play devices.vbs ├── plug and play signed drivers.vbs ├── pointing device properties.vbs └── sound card properties.vbs ├── Ports and Slots ├── README.md ├── parallel port properties.vbs ├── pcmcia controller info.vbs ├── port connector properties.vbs ├── port resource info.vbs ├── serial port config properties.vbs ├── serial port properties.vbs └── system slot properties.vbs ├── Power Supply and Batteries ├── README.md ├── battery info.vbs └── portable battery info.vbs ├── README.md ├── SECURITY.md ├── SMTP Mail ├── README.md ├── email without installing smtp service.vbs └── send email from script.vbs ├── Special Folders ├── README.md ├── all.vbs ├── applicaiton data.vbs ├── application data.vbs ├── cd burning.vbs ├── common admin tools.vbs ├── common application data.vbs ├── common desktop.vbs ├── common documents.vbs ├── common favourites.vbs ├── common music.vbs ├── common pictures.vbs ├── common program files.vbs ├── common start menu programs.vbs ├── common startup.vbs ├── common templates.vbs ├── common video.vbs ├── control panel.vbs ├── cookies.vbs ├── desktop.vbs ├── fonts.vbs ├── history.vbs ├── internet explorer.vbs ├── internet favourites.vbs ├── local application data.vbs ├── my computer.vbs ├── my documents.vbs ├── my music.vbs ├── my pictures.vbs ├── my recent documents.vbs ├── my videos.vbs ├── nethood.vbs ├── network connections.vbs ├── network places.vbs ├── printers and faxes.vbs ├── printhood.vbs ├── profile folder.vbs ├── program files.vbs ├── recycle bin.vbs ├── sendto.vbs ├── start menu ├── startmenu.vbs ├── startup.vbs ├── system directory.vbs ├── templates.vbs ├── temporary internet files.vbs └── windows directory.vbs ├── Startup and Shutdown ├── README.md ├── boot config properties.vbs ├── list startup.vbs ├── modify recovery config options.vbs ├── modify system startup delay.vbs ├── recovery configuration options.vbs ├── restart pc.vbs ├── shutdown pc.vbs └── startup options.vbs ├── System Restore ├── README.md ├── conduct system restore.vbs ├── create system restore point.vbs ├── disable full system restore.vbs ├── enable full system restore.vbs ├── list existing restore points.vbs ├── list results of previous system restore.vbs ├── list system restore config values.vbs └── modify system restore config values.vbs ├── Video ├── README.md ├── desktop monitor properties.vbs ├── display config values.vbs ├── video adapter info.vbs ├── video controller properties.vbs └── video controller resolutions.vbs ├── Windows Activation ├── README.md ├── offline activation.vbs ├── online activation.vbs ├── product activation status.vbs └── suppress notices.vbs ├── active directory check.vbs ├── active directory database replication.vbs ├── active directory database.vbs ├── active directory replication.vbs ├── active directory site link.vbs ├── active directory.vbs ├── add additional home phone number.vbs ├── add additional url to user account.vbs ├── add route to user account.vbs ├── add rows to access database.vbs ├── add sample users.vbs ├── add utf8 byte order mark.vbs ├── addition.vbs ├── additional postofficebox information for user account.vbs ├── add UTF-16 byte order mark to a text file.vbs ├── assign group manager.vbs ├── assign new manger ou.vbs ├── assign password to user.vbs ├── assign primary group for user.vbs ├── attributes of OU class.vbs ├── attribution group class.vbs ├── auto generate file name.vbs ├── capslock.vbs ├── change password.vbs ├── check whether a file is valid.vbs ├── clear com attributes.vbs ├── clear com partition link.vbs ├── clear general properties ou.vbs ├── clear group policy links assigned to ou.vbs ├── clearing user account attributes.vbs ├── configure trust relationship.vbs ├── configuring index service to autostart.vbs ├── connect and query access database.vbs ├── convert name to adspath.vbs ├── convert utf-8 to ansi.vbs ├── copy active directory account.vbs ├── copy allow logon hours.vbs ├── copy published certificate to user account.vbs ├── copy published certificate.vbs ├── create access database.vbs ├── create access table.vbs ├── create account.vbs ├── create active directory site.vbs ├── create active directory subnet.vbs ├── create an ou.vbs ├── create and name text file.vbs ├── create contact active directory.vbs ├── create indexing service catalog.vbs ├── create indexing service scope.vbs ├── create ou in an ou.vbs ├── create pivot chart without excel.vbs ├── create pivot table in excel.vbs ├── create pivot table.vbs ├── create text file.vbs ├── create user account and add to group.vbs ├── create user account.vbs ├── delete account.vbs ├── delete active directory subnet.vbs ├── delete address page information for user account.vbs ├── delete all contents of text file.vbs ├── delete all published certificates from user account.vbs ├── delete an ou.vbs ├── delete calling station id.vbs ├── delete department and direct report information.vbs ├── delete dialin properties for user account.vbs ├── delete first n lines of text file.vbs ├── delete group.vbs ├── delete indexing service catalog.vbs ├── delete indexing service scope.vbs ├── delete last n lines of a text file.vbs ├── delete line range.vbs ├── delete lines of text file beginning with a specified string.vbs ├── delete n-th line of text file.vbs ├── delete othermobile phone number.vbs ├── delete post office box from user account.vbs ├── delete published certificates from user account.vbs ├── delete selected attributes from user account.vbs ├── delete selected user account attributes.vbs ├── delete software.vbs ├── delete user account telephone attributes.vbs ├── delete user account.vbs ├── deleting files in directory.vbs ├── dial in property configuration.vbs ├── disabked user accounts.vbs ├── disable global catalog server.vbs ├── disable smartcard attribute for user account.vbs ├── disable user account.vbs ├── domain information.vbs ├── domain local distribution group.vbs ├── enable global catalog server.vbs ├── enable user account.vbs ├── enable user logon.vbs ├── enable user password changes.vbs ├── enumerate installed odbc drivers.vbs ├── enumerate installed ole db.vbs ├── extract data from microsoft excel.vbs ├── extract data from multiple excel workbooks.vbs ├── fakemalware.vbs ├── fax server activity logging options.vbs ├── fax server event logging options.vbs ├── fax server incoming archive information.vbs ├── fax server incoming queue information.vbs ├── fax server information.vbs ├── fax server outgoing archive information.vbs ├── fax server receipt options.vbs ├── fax server security information.vbs ├── frs replication.vbs ├── general properties of ou.vbs ├── general properties.vbs ├── geolocation of ip address.vbs ├── geolocation.vbs ├── global distribution group.vbs ├── gps coordinates.vbs ├── group object information.vbs ├── group policy information.vbs ├── information about binary files used by application.vbs ├── install software on local machine.vbs ├── install software on remote machine ├── internet explorer.vbs ├── join pc to domain.vbs ├── list account page information.vbs ├── list active directory connections.vbs ├── list active directory sites.vbs ├── list address page information for user account.vbs ├── list all attributes of user class.vbs ├── list all domain controllers.vbs ├── list all installed software.vbs ├── list all tables in a microsoft access database.vbs ├── list all tables.vbs ├── list all telephone settings.vbs ├── list all worksheets.vbs ├── list allowed user logon hours.vbs ├── list audit permissions for a user account.vbs ├── list codec files on computer.vbs ├── list com+ information.vbs ├── list com+ partition sets.vbs ├── list com+ partitions.vbs ├── list com+ properties of OU ├── list domain controller.vbs ├── list domain info wmi.vbs ├── list domain or workgroup.vbs ├── list domain password policy settings.vbs ├── list domain password property attributes.vbs ├── list fax server device information.vbs ├── list fax server device providers.vbs ├── list fax server outgoing queue information.vbs ├── list fsmo role holders.vbs ├── list group memberships.vbs ├── list indexing service catalogs.vbs ├── list indexing service scopes.vbs ├── list installed or advertised components and applications.vbs ├── list installed software features.vbs ├── list installed software.vbs ├── list local users and owner.vbs ├── list managed information.vbs ├── list microsoft product ids.vbs ├── list object page information for a user account.vbs ├── list operating system.vbs ├── list organisation information for user account.vbs ├── list owner of ou.vbs ├── list owner of user account.vbs ├── list password attributes for user account.vbs ├── list power management information.vbs ├── list processor information.vbs ├── list protocols bridgehead server replicates.vbs ├── list protocols bridgehead server.vbs ├── list published certificates.vbs ├── list selected attributes.vbs ├── list servers in active directory site.vbs ├── list site name for domain controller.vbs ├── list state of indexing service.vbs ├── list subnets in all active directories sites.vbs ├── list subnets in an active directory site.vbs ├── list system locations.vbs ├── list tables and columns.vbs ├── list trust relationships.vbs ├── list useraccountcontrol.vbs ├── local computer information.vbs ├── managing information for group.vbs ├── members of groups.vbs ├── modify COM+ partition set link.vbs ├── modify account page information.vbs ├── modify address page information for user account.vbs ├── modify attributes.vbs ├── modify com+ information for user account.vbs ├── modify dialin properties for user account.vbs ├── modify expiration date.vbs ├── modify general properties.vbs ├── modify general user account attributes.vbs ├── modify group attributes.vbs ├── modify group type.vbs ├── modify odbc default value when reading text files.vbs ├── modify odbc default value.vbs ├── modify organisation properties for user accounts.vbs ├── modify upn suffixes.vbs ├── modify user account address attributes.vbs ├── modify user account general properties.vbs ├── modify user account telephone numbers.vbs ├── modify user profile paths.vbs ├── modify user profile properties.vbs ├── modify user telephone properties.vbs ├── monitor active directory database performance.vbs ├── monitor domain controller performance.vbs ├── monitor fax server activity.vbs ├── monitor indexing service filter performance.vbs ├── monitor indexing service performance.vbs ├── move a user account to new domain.vbs ├── move a user account.vbs ├── move account domain.vbs ├── move account.vbs ├── move domain controller.vbs ├── move group within domain.vbs ├── new group policy link to ou.vbs ├── new members security group.vbs ├── non expiring password.vbs ├── notepad.vbs ├── ntds performance.vbs ├── open website.vbs ├── other groups.vbs ├── owner of group.vbs ├── pause indexing service.vbs ├── physical and virtual memory information.vbs ├── premium.vbs ├── prevent password changing.vbs ├── prevent password storing.vbs ├── primary group user account.vbs ├── properties of ou object.vbs ├── read active directory security descriptor.vbs ├── read comma seperated text file.vbs ├── read csv file.vbs ├── read entire text file.vbs ├── read fixed-width text file using database techniques.vbs ├── read n-th line of text file.vbs ├── read semicolon text file.vbs ├── read tab seperated text file.vbs ├── read text file backwards.vbs ├── read text file character by character.vbs ├── read text file into array.vbs ├── read utf-8 comma seperated text file.vbs ├── remain active directory site.vbs ├── remove all group membership.vbs ├── remove all members of group.vbs ├── remove group manager.vbs ├── remove ou manager.vbs ├── remove user from group.vbs ├── remove utf-16 byte order mark.vbs ├── remove utf8 byte order mark.vbs ├── rename account.vbs ├── rename both.vbs ├── replace group members.vbs ├── require password change.vbs ├── require smartcard.vbs ├── reset password.vbs ├── resume indexing service.vbs ├── sample accounts.vbs ├── scope of security group.vbs ├── search for accounts.vbs ├── search for files using indexing service.vbs ├── search for user account.vbs ├── search indexing server using predefined query.vbs ├── search indexing service use free text search.vbs ├── security descriptor for group.vbs ├── security descriptor.vbs ├── security groups.vbs ├── security permissions for user account.vbs ├── see when password changes.vbs ├── select data from an sqlite database.vbs ├── set userr account to never expire.vbs ├── show computer model.vbs ├── show language.vbs ├── site name for local computer.vbs ├── specified files included in indexing service.vbs ├── start indexing service.vbs ├── stop indexing service.vbs ├── subtraction.vbs ├── system access control list.vbs ├── system control list.vbs ├── system restore.vbs ├── text to speech.vbs ├── typing hack.vbs ├── universal distribution group.vbs ├── universal security group.vbs ├── unjoin computer.vbs ├── unlock user account.vbs ├── upgrade software.vbs ├── user account address page attributes.vbs ├── user account general page properties.vbs ├── user account page properties.vbs ├── user expiry date.vbs ├── user profile properties.vbs ├── user status.vbs ├── v_Data_ArrayList.vbs ├── verify computer role.vbs ├── verify computer.vbs ├── verify domain controller.vbs ├── verify size of file.vbs ├── verify sql server installation.vbs ├── verify whether users can changer own passwords.vbs ├── view password expiry.vbs ├── writing data to text file.vbs ├── writing data to txt file.vbs ├── writing string content following nth line.vbs ├── writing string content to beginning of text file.vbs └── writing string content.vbs /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @Eggy115 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | t 3 | -------------------------------------------------------------------------------- /Explorer Settings/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Explorer Settings/README.md -------------------------------------------------------------------------------- /Explorer Settings/add template.vbs: -------------------------------------------------------------------------------- 1 | ' Add a Template to the Windows Explorer New Menu 2 | 3 | 4 | Set objShell = WScript.CreateObject("WScript.Shell") 5 | objShell.RegWrite "HKCR\.VBS\ShellNew\FileName","template.vbs" 6 | -------------------------------------------------------------------------------- /Explorer Settings/command prompt menu here.vbs: -------------------------------------------------------------------------------- 1 | ' Add "Command Prompt Here" to Windows Explorer 2 | 3 | 4 | Set objShell = CreateObject("WScript.Shell") 5 | 6 | objShell.RegWrite "HKCR\Folder\Shell\MenuText\Command\", _ 7 |     "cmd.exe /k cd " & chr(34) & "%1" & chr(34) 8 | objShell.RegWrite "HKCR\Folder\Shell\MenuText\", "Command Prompt Here" 9 | -------------------------------------------------------------------------------- /Explorer Settings/environmental variables.vbs: -------------------------------------------------------------------------------- 1 | ' List Environment Variables on a Computer 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colItems = objWMIService.ExecQuery("Select * from Win32_Environment") 9 | 10 | For Each objItem in colItems 11 |     Wscript.Echo "Description: " & objItem.Description 12 |     Wscript.Echo "Name: " & objItem.Name 13 |     Wscript.Echo "System Variable: " & objItem.SystemVariable 14 |     Wscript.Echo "User Name: " & objItem.UserName 15 |     Wscript.Echo "Variable Value: " & objItem.VariableValue 16 | Next 17 | -------------------------------------------------------------------------------- /Explorer Settings/list administrative tools.vbs: -------------------------------------------------------------------------------- 1 | ' List Installed Administrative Tools 2 | 3 | 4 | Const ADMINISTRATIVE_TOOLS = &H2f& 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(ADMINISTRATIVE_TOOLS) 8 | Set objTools = objFolder.Items 9 | 10 | For i = 0 to objTools.Count - 1 11 |     Wscript.Echo objTools.Item(i) 12 | Next 13 | 14 | -------------------------------------------------------------------------------- /Explorer Settings/list start menu items.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Start Menu Items 3 | 4 | 5 | On Error Resume Next 6 | 7 | strComputer = "." 8 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery _ 11 |     ("Select * from Win32_LogicalProgramGroupItem") 12 | 13 | For Each objItem in colItems 14 |     Wscript.Echo "Name: " & objItem.Name 15 | Next 16 | -------------------------------------------------------------------------------- /Explorer Settings/list start menu program groups.vbs: -------------------------------------------------------------------------------- 1 | ' List Start Menu Program Groups 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery("Select * from Win32_ProgramGroup") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Description: " & objItem.Description 14 |     Wscript.Echo "Group Name: " & objItem.GroupName 15 |     Wscript.Echo "Name: " & objItem.Name 16 |     Wscript.Echo "User Name: " & objItem.UserName 17 |     Wscript.Echo 18 | Next 19 | -------------------------------------------------------------------------------- /Explorer Settings/path to pictures.vbs: -------------------------------------------------------------------------------- 1 | ' List Path to the My Pictures Folders 2 | 3 | 4 | Const MY_PICTURES = &H27& 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(MY_PICTURES) 7 | Set objFolderItem = objFolder.Self       8 | Wscript.Echo objFolderItem.Name & ": " & objFolderItem.Path 9 | -------------------------------------------------------------------------------- /Explorer Settings/rename my computer icon.vbs: -------------------------------------------------------------------------------- 1 | ' Rename the My Computer Icon on the Local Computer 2 | 3 | 4 | Const MY_COMPUTER = &H11& 5 | 6 | Set objNetwork = CreateObject("Wscript.Network") 7 | objComputerName = objNetwork.ComputerName 8 | Set objShell = CreateObject("Shell.Application") 9 | Set objFolder = objShell.Namespace(MY_COMPUTER) 10 | Set objFolderItem = objFolder.Self 11 | objFolderItem.Name = objComputerName 12 | -------------------------------------------------------------------------------- /Group Policy/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Group Policy/README.md -------------------------------------------------------------------------------- /Group Policy/group policy links.vbs: -------------------------------------------------------------------------------- 1 | ' List Resultant Set of Policy Group Policy Links 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject _ 6 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 7 | 8 | Set colItems = objWMIService.ExecQuery("Select * from RSOP_GPLink") 9 | 10 | For Each objItem in colItems 11 |     Wscript.Echo "GPO: " & objItem.GPO 12 |     Wscript.Echo "Applied Order: " & objItem.AppliedOrder 13 |     Wscript.Echo "Enabled: " & objItem.Enabled 14 |     Wscript.Echo "Link Order: " & objItem.LinkOrder 15 |     Wscript.Echo "No Overrride: " & objItem.NoOverride 16 |     Wscript.Echo "SOM Order: " & objItem.SOMOrder 17 |     Wscript.Echo 18 | Next 19 | 20 | -------------------------------------------------------------------------------- /Group Policy/group policy settings.vbs: -------------------------------------------------------------------------------- 1 | ' List Resultant Set of Policy Policy Settings 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject _ 6 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 7 | 8 | Set colItems = objWMIService.ExecQuery("Select * from RSOP_PolicySetting") 9 | 10 | For Each objItem in colItems 11 |     Wscript.Echo "GPO ID: " & objItem.GPOID 12 |     Wscript.Echo "ID: " & objItem.ID 13 |     Wscript.Echo "Precedence: " & objItem.Precedence 14 |     Wscript.Echo "SOM ID: " & objItem.SOMID 15 |     Wscript.Echo 16 | Next 17 | -------------------------------------------------------------------------------- /Group Policy/policy audit policies.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Resultant Set of Policy Audit Policies 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject _ 7 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 8 | 9 | Set colItems = objWMIService.ExecQuery("Select * from RSOP_AuditPolicy") 10 | 11 | For Each objItem in colItems   12 |     Wscript.Echo "Category: " & objItem.Category 13 |     Wscript.Echo "Precedence: " & objItem.Precedence 14 |     Wscript.Echo "Failure: " & objItem.Failure 15 |     Wscript.Echo "Success: " & objItem.Success 16 |     Wscript.Echo 17 | Next 18 | 19 | -------------------------------------------------------------------------------- /Group Policy/policy scopes.vbs: -------------------------------------------------------------------------------- 1 | ' Enumerating Resultant Set of Policy Scopes of Management 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject _ 6 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 7 | 8 | Set colItems = objWMIService.ExecQuery("Select * from RSOP_SOM") 9 | 10 | For Each objItem in colItems 11 |     Wscript.Echo "ID: " & objItem.ID 12 |     Wscript.Echo "Blocked: " & objItem.Blocked 13 |     Wscript.Echo "Blocking: " & objItem.Blocking 14 |     Wscript.Echo "Reason: " & objItem.Reason 15 |     Wscript.Echo "SOM Order: " & objItem.SOMOrder 16 |     Wscript.Echo "Type: " & objItem.Type 17 |     Wscript.Echo 18 | Next 19 | -------------------------------------------------------------------------------- /Group Policy/policy security even log boolean.vbs: -------------------------------------------------------------------------------- 1 | ' Enumerating Resultant Set of Policy Security Event Log Settings -- Boolean 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject _ 6 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 7 | 8 | Set colItems = objWMIService.ExecQuery _ 9 |     ("Select * from RSOP_SecurityEventLogSettingBoolean") 10 | 11 | For Each objItem in colItems 12 |     Wscript.Echo "Key Name: " & objItem.KeyName 13 |     Wscript.Echo "Precedence: " & objItem.Precedence 14 |     Wscript.Echo "Setting: " & objItem.Setting 15 |     Wscript.Echo "Type: " & objItem.Type 16 |     Wscript.Echo 17 | Next 18 | -------------------------------------------------------------------------------- /Group Policy/policy security event log numberic.vbs: -------------------------------------------------------------------------------- 1 | ' Enumerating Resultant Set of Policy Security Event Log Settings -- Numeric 2 | 3 | 4 | Set objWMIService = GetObject _ 5 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 6 | 7 | Set colItems = objWMIService.ExecQuery _ 8 |     ("Select * from RSOP_SecurityEventLogSettingNumeric") 9 | 10 | For Each objItem in colItems 11 |     Wscript.Echo "Key Name: " & objItem.KeyName 12 |     Wscript.Echo "Precedence: " & objItem.Precedence 13 |     Wscript.Echo "Setting: " & objItem.Setting 14 |     Wscript.Echo "Type: " & objItem.Type 15 |     Wscript.Echo 16 | Next 17 | -------------------------------------------------------------------------------- /Group Policy/policy security settings boolean.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Enumerating Resultant Set of Policy Security Settings -- Boolean 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject _ 7 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 8 | 9 | Set colItems = objWMIService.ExecQuery _ 10 |     ("Select * from RSOP_SecuritySettingBoolean") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Key Name: " & objItem.KeyName 14 |     Wscript.Echo "Precedence: " & objItem.Precedence 15 |     Wscript.Echo "Setting: " & objItem.Setting 16 |     Wscript.Echo 17 | Next 18 | -------------------------------------------------------------------------------- /Group Policy/policy security settings numeric.vbs: -------------------------------------------------------------------------------- 1 | ' Enumerating Resultant Set of Policy Security Settings -- Numeric 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject _ 6 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 7 | 8 | Set colItems = objWMIService.ExecQuery _ 9 |     ("Select * from RSOP_SecuritySettingNumeric") 10 | 11 | For Each objItem in colItems 12 |     Wscript.Echo "Key Name: " & objItem.KeyName 13 |     Wscript.Echo "Precedence: " & objItem.Precedence 14 |     Wscript.Echo "Setting: " & objItem.Setting 15 |     Wscript.Echo 16 | Next 17 | -------------------------------------------------------------------------------- /Group Policy/policy system services.vbs: -------------------------------------------------------------------------------- 1 | ' Enumerating Resultant Set of Policy System Services 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject _ 6 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 7 | 8 | Set colItems = objWMIService.ExecQuery("Select * from RSOP_SystemService") 9 | 10 | For Each objItem in colItems 11 |     Wscript.Echo "Service: " & objItem.Service 12 |     Wscript.Echo "Precedence: " & objItem.Precedence 13 |     Wscript.Echo "SDDL String: " & objItem.SDDLString 14 |     Wscript.Echo "Startup Mode: " & objItem.StartupMode 15 |     Wscript.Echo 16 | Next 17 | -------------------------------------------------------------------------------- /Group Policy/user privelege rights.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Resultant Set of Policy User Privilege Rights 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject _ 7 |     ("winmgmts:\\" & strComputer & "\root\rsop\computer") 8 | 9 | Set colItems = objWMIService.ExecQuery("Select * from RSOP_UserPrivilegeRight") 10 | 11 | For Each objItem in colItems 12 |     For Each strAccountList in objItem.AccountList 13 |         Wscript.Echo "Account list: " & strAccountList 14 |     Next 15 |     Wscript.Echo "Precedence: " & objItem.Precedence 16 |     Wscript.Echo "User Right: " & objItem.UserRight 17 |     Wscript.Echo 18 | Next 19 | -------------------------------------------------------------------------------- /Hardware and Firmware/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Hardware and Firmware/README.md -------------------------------------------------------------------------------- /Hardware and Firmware/chassis type.vbs: -------------------------------------------------------------------------------- 1 | ' Identifying Computer Chassis Type 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colChassis = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_SystemEnclosure") 10 | 11 | For Each objChassis in colChassis 12 |     For i = Lbound(objChassis.ChassisTypes) to Ubound(objChassis.ChassisTypes) 13 |         Wscript.Echo objChassis.ChassisTypes(i) 14 |     Next 15 | Next 16 | -------------------------------------------------------------------------------- /Hardware and Firmware/computer bus properties.vbs: -------------------------------------------------------------------------------- 1 | ' List Computer Bus Properties 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery("Select * from Win32_Bus") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Bus Number: " & objItem.BusNum 14 |     Wscript.Echo "Bus Type: " & objItem.BusType 15 |     Wscript.Echo "Description: " & objItem.Description 16 |     Wscript.Echo "Device ID: " & objItem.DeviceID 17 |     Wscript.Echo "Name: " & objItem.Name 18 |     Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID 19 | Next 20 | -------------------------------------------------------------------------------- /Hardware and Firmware/motherboard device info.vbs: -------------------------------------------------------------------------------- 1 | ' List Motherboard Device Information 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery("Select * from Win32_MotherboardDevice") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Device ID: " & objItem.DeviceID 14 |     Wscript.Echo "Primary Bus Type: " & objItem.PrimaryBusType 15 |     Wscript.Echo "Secondary Bus Type: " & objItem.SecondaryBusType 16 |     Wscript.Echo 17 | Next 18 | 19 | -------------------------------------------------------------------------------- /Hardware and Firmware/smbios info.vbs: -------------------------------------------------------------------------------- 1 | ' List SMBIOS Information 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colSMBIOS = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_SystemEnclosure") 10 | 11 | For Each objSMBIOS in colSMBIOS 12 |     Wscript.Echo "Part Number: " & objSMBIOS.PartNumber 13 |     Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber 14 |     Wscript.Echo "Asset Tag: " & objSMBIOS.SMBIOSAssetTag 15 | Next 16 | -------------------------------------------------------------------------------- /Internet Explorer/Add a Web Site to the Favorites Menu.vbs: -------------------------------------------------------------------------------- 1 | ' Add a Web Site to the Favorites Menu 2 | 3 | 4 | Const ADMINISTRATIVE_TOOLS = 6 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(ADMINISTRATIVE_TOOLS) 8 | Set objFolderItem = objFolder.Self 9 | 10 | Set objShell = WScript.CreateObject("WScript.Shell") 11 | strDesktopFld = objFolderItem.Path 12 | Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\MSDN.url") 13 | objURLShortcut.TargetPath = "http://msdn.microsoft.com" 14 | objURLShortcut.Save 15 | -------------------------------------------------------------------------------- /Internet Explorer/Delete a Site from an Internet Explorer Security Zone.vbs: -------------------------------------------------------------------------------- 1 | ' Delete a Site from an Internet Explorer Security Zone 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const HKEY_CURRENT_USER = &H80000001 7 | 8 | strComputer = "." 9 | Set objReg = GetObject("winmgmts:" _ 10 | & "{impersonationLevel=impersonate}\\" & strComputer & _ 11 | "\root\default:StdRegProv") 12 | 13 | strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _ 14 | & "ZoneMap\ESCDomains\Contoso.com" 15 | objReg.DeleteKey HKEY_CURRENT_USER, strKeyPath 16 | -------------------------------------------------------------------------------- /Internet Explorer/Delete an Allowed Protocol from an Internet Explorer Security Zone Site.vbs: -------------------------------------------------------------------------------- 1 | ' Delete an Allowed Protocol from an Internet Explorer Security Zone Site 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const HKEY_CURRENT_USER = &H80000001 7 | 8 | strComputer = "." 9 | 10 | Set objReg = GetObject("winmgmts:" _ 11 | & "{impersonationLevel=impersonate}\\" & strComputer & _ 12 | "\root\default:StdRegProv") 13 | 14 | strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _ 15 | & "ZoneMap\ESCDomains\Finance" 16 | strDWORDValueName = "http" 17 | 18 | objReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strDWORDValueName 19 | -------------------------------------------------------------------------------- /Internet Explorer/List Internet Explorer COM Object Settings.vbs: -------------------------------------------------------------------------------- 1 | ' List Internet Explorer COM Object Settings 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 | & "{impersonationLevel=impersonate}!\\" & strComputer & _ 7 | "\root\cimv2\Applications\MicrosoftIE") 8 | 9 | Set colIESettings = objWMIService.ExecQuery _ 10 | ("Select * from MicrosoftIE_Object") 11 | 12 | For Each strIESetting in colIESettings 13 | Wscript.Echo "Code base: " & strIESetting.CodeBase 14 | Wscript.Echo "Program file: " & strIESetting.ProgramFile 15 | Wscript.Echo "Status: " & strIESetting.Status 16 | Next 17 | -------------------------------------------------------------------------------- /Internet Explorer/List Internet Explorer Cache Settings.vbs: -------------------------------------------------------------------------------- 1 | ' List Internet Explorer Cache Settings 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 | & "{impersonationLevel=impersonate}!\\" & strComputer & _ 7 | "\root\cimv2\Applications\MicrosoftIE") 8 | 9 | Set colIESettings = objWMIService.ExecQuery _ 10 | ("Select * from MicrosoftIE_Cache") 11 | 12 | For Each strIESetting in colIESettings 13 | Wscript.Echo "Page refresh type: " & strIESetting.PageRefreshType 14 | Wscript.Echo "Temporary Internet files folder: " & _ 15 | strIESetting.TempInternetFilesFolder 16 | Next 17 | -------------------------------------------------------------------------------- /Internet Explorer/List Internet Explorer Security Zone Settings.vbs: -------------------------------------------------------------------------------- 1 | ' List Internet Explorer Security Zone Settings 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 | & "{impersonationLevel=impersonate}!\\" & strComputer & _ 7 | "\root\cimv2\Applications\MicrosoftIE") 8 | 9 | Set colIESettings = objWMIService.ExecQuery _ 10 | ("Select * from MicrosoftIE_Security") 11 | 12 | For Each strIESetting in colIESettings 13 | Wscript.Echo "Zone name: " & strIESetting.Zone 14 | Wscript.Echo "Security level: " & strIESetting.Level 15 | Next 16 | -------------------------------------------------------------------------------- /Internet Explorer/List Items in the Internet Cookies Folder.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the Internet Cookies Folder 2 | 3 | 4 | Const COOKIES = &H21& 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(COOKIES) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set colItems = objFolder.Items 12 | For Each objItem in colItems 13 | Wscript.Echo objItem.Name 14 | Next 15 | -------------------------------------------------------------------------------- /Internet Explorer/List Items in the Internet Favorites Folder.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the Internet Favorites Folder 2 | 3 | 4 | Const FAVORITES = &H6& 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(FAVORITES) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set colItems = objFolder.Items 12 | For Each objItem in colItems 13 | Wscript.Echo objItem.Name 14 | Next 15 | -------------------------------------------------------------------------------- /Internet Explorer/List Items in the Temporary Internet Files Folder.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the Temporary Internet Files Folder 2 | 3 | 4 | Const TEMPORARY_INTERNET_FILES = &H20& 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set colItems = objFolder.Items 12 | For Each objItem in colItems 13 | Wscript.Echo objItem.Name 14 | Next 15 | -------------------------------------------------------------------------------- /Internet Explorer/List the Items in the Internet Explorer History Folder.vbs: -------------------------------------------------------------------------------- 1 | ' List the Items in the Internet Explorer History Folder 2 | 3 | 4 | Const LOCAL_SETTINGS_HISTORY = &H22& 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(LOCAL_SETTINGS_HISTORY) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set colItems = objFolder.Items 12 | For Each objItem in colItems 13 | Wscript.Echo objItem.Name 14 | Next 15 | -------------------------------------------------------------------------------- /Internet Explorer/List the Path to the Internet Explorer Folder.vbs: -------------------------------------------------------------------------------- 1 | ' List the Path to the Internet Explorer Folder 2 | 3 | 4 | Const INTERNET_EXPLORER = &H1& 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(INTERNET_EXPLORER) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | -------------------------------------------------------------------------------- /Internet Explorer/Modify Advanced Internet Explorer Settings.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Advanced Internet Explorer Settings 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const HKEY_CURRENT_USER = &H80000001 7 | 8 | strComputer = "." 9 | strValue = "no" 10 | 11 | Set objReg = GetObject("winmgmts:" _ 12 | & "{impersonationLevel=impersonate}\\" & strComputer & _ 13 | "\root\default:StdRegProv") 14 | 15 | strKeyPath = "Software\Microsoft\Internet Explorer\Main" 16 | objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, _ 17 | "NotifyDownloadComplete",strValue 18 | -------------------------------------------------------------------------------- /Internet Explorer/Modify Internet Explorer Security Settings.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Internet Explorer Security Settings 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const HKEY_CURRENT_USER = &H80000001 7 | 8 | strComputer = "." 9 | 10 | Set objReg = GetObject("winmgmts:" _ 11 | & "{impersonationLevel=impersonate}\\" & strComputer & _ 12 | "\root\default:StdRegProv") 13 | 14 | strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _ 15 | & "Zones\1" 16 | strEntryName = "1400" 17 | dwvalue = 0 18 | objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strEntryName,dwValue 19 | -------------------------------------------------------------------------------- /Internet Information Server/IIS 5/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Internet Information Server/IIS 5/README.md -------------------------------------------------------------------------------- /Internet Information Server/IIS 6/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Internet Information Server/IIS 6/README.md -------------------------------------------------------------------------------- /Internet Information Server/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Internet Information Server/README.md -------------------------------------------------------------------------------- /Logon Sessions/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Logon Sessions/README.md -------------------------------------------------------------------------------- /Logon Sessions/list logon session info.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Logon Session Information 3 | 4 | 5 | On Error Resume Next 6 | 7 | strComputer = "." 8 | Set objWMIService = GetObject("winmgmts:" _ 9 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 10 | 11 | Set colItems = objWMIService.ExecQuery("Select * from Win32_LogonSession") 12 | 13 | For Each objItem in colItems 14 |     Wscript.Echo "Authentication Package: " & objItem.AuthenticationPackage 15 |     Wscript.Echo "Logon ID: " & objItem.LogonId 16 |     Wscript.Echo "Logon Type: " & objItem.LogonType 17 |     Wscript.Echo "Start Time: " & objItem.StartTime 18 |     Wscript.Echo 19 | Next 20 | -------------------------------------------------------------------------------- /Logon Sessions/user passport info.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List User Passport Information 4 | 5 | 6 | Set objUser = CreateObject("UserAccounts.PassportManager") 7 | Wscript.Echo "Current Passport: " & objUser.CurrentPassport 8 | Wscript.Echo "Member services URL: " & objUser.MemberServicesURL 9 | -------------------------------------------------------------------------------- /Logon Sessions/users on remote computers.vbs: -------------------------------------------------------------------------------- 1 | ' List the User Logged on to a Remote Computer 2 | 3 | 4 | strComputer = "atl-ws-o1" 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colComputer = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_ComputerSystem") 10 | 11 | For Each objComputer in colComputer 12 |     Wscript.Echo "Logged-on user: " & objComputer.UserName 13 | Next 14 | -------------------------------------------------------------------------------- /Logs/Event Logs/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Logs/Event Logs/README.md -------------------------------------------------------------------------------- /Logs/Event Logs/all stop events.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List All Stop Events 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 8 | 9 | Set colLoggedEvents = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_NTLogEvent Where Logfile = 'System'" _ 11 |         & " and SourceName = 'SaveDump'") 12 | 13 | For Each objEvent in colLoggedEvents 14 |     Wscript.Echo "Event date: " & objEvent.TimeGenerated 15 |     Wscript.Echo "Description: " & objEvent.Message 16 | Next 17 | 18 | -------------------------------------------------------------------------------- /Logs/Event Logs/backup and clear eventlog.vbs: -------------------------------------------------------------------------------- 1 | ' Back Up and Clear an Event Log 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate,(Backup)}!\\" & _ 7 |         strComputer & "\root\cimv2") 8 | 9 | Set colLogFiles = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_NTEventLogFile where LogFileName='Application'") 11 | 12 | For Each objLogfile in colLogFiles 13 |     errBackupLog = objLogFile.BackupEventLog("c:\scripts\application.evt") 14 |     If errBackupLog <> 0 Then         15 |         Wscript.Echo "The Application event log could not be backed up." 16 |     Else 17 |         objLogFile.ClearEventLog() 18 |     End If 19 | Next 20 | -------------------------------------------------------------------------------- /Logs/Event Logs/backup and clear large event logs.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Back Up and Clear Large Event Logs 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate, (Backup, Security)}!\\" _ 8 |         & strComputer & "\root\cimv2") 9 | 10 | Set colLogFiles = objWMIService.ExecQuery _ 11 |     ("Select * from Win32_NTEventLogFile") 12 | 13 | For Each objLogfile in colLogFiles 14 |     If objLogFile.FileSize > 100000 Then 15 |        strBackupLog = objLogFile.BackupEventLog _ 16 |            ("c:\scripts\" & objLogFile.LogFileName & ".evt") 17 |        objLogFile.ClearEventLog() 18 |     End If 19 | Next 20 | -------------------------------------------------------------------------------- /Logs/Event Logs/custom event log.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Create a Custom Event Log 3 | 4 | 5 | Const NO_VALUE = Empty 6 | 7 | Set WshShell = WScript.CreateObject("WScript.Shell") 8 | WshShell.RegWrite _ 9 |     "HKLM\System\CurrentControlSet\Services\EventLog\Scripts\", NO_VALUE 10 | -------------------------------------------------------------------------------- /Logs/Event Logs/list system event log properties.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List System Event Log Properties 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 8 | 9 | Set colLogFiles = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_NTEventLogFile where LogFileName='System'") 11 | 12 | For Each objLogFile in colLogFiles 13 |     Wscript.Echo objLogFile.NumberOfRecords 14 | Next 15 | -------------------------------------------------------------------------------- /Logs/Event Logs/security log properties.vbs: -------------------------------------------------------------------------------- 1 | ' List Security Log Properties 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate,(Security)}!\\" & _ 7 |         strComputer & "\root\cimv2") 8 | 9 | Set colLogFiles = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_NTEventLogFile where LogFileName='Security'") 11 | 12 | For Each objLogFile in colLogFiles 13 |     Wscript.Echo objLogFile.NumberOfRecords 14 |     Wscript.Echo "Maximum Size: " &  objLogfile.MaxFileSize 15 | Next 16 | -------------------------------------------------------------------------------- /Logs/Event Logs/specific events from event log.vbs: -------------------------------------------------------------------------------- 1 | ' List Specific Events from an Event Log 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colLoggedEvents = objWMIService.ExecQuery _ 9 |         ("Select * from Win32_NTLogEvent Where Logfile = 'System' and " _ 10 |             & "EventCode = '6008'") 11 | 12 | Wscript.Echo "Improper shutdowns: " & colLoggedEvents.Count 13 | -------------------------------------------------------------------------------- /Logs/Event Logs/write events to local event log.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ' Write Events to the Local Event Log 5 | 6 | 7 | Const EVENT_SUCCESS = 0 8 | 9 | Set objShell = Wscript.CreateObject("Wscript.Shell") 10 | 11 | objShell.LogEvent EVENT_SUCCESS, _ 12 |     "Payroll application successfully installed." 13 | -------------------------------------------------------------------------------- /Logs/Event Logs/write events to remote event log.vbs: -------------------------------------------------------------------------------- 1 | ' Write Events to a Remote Event Log 2 | 3 | 4 | Const EVENT_SUCCESS = 0 5 | 6 | Set objShell = Wscript.CreateObject("Wscript.Shell") 7 | 8 | objShell.LogEvent EVENT_SUCCESS, _ 9 |     "Payroll application successfully installed." , "\\PrimaryServer" 10 | 11 | -------------------------------------------------------------------------------- /Logs/Event Logs/wrtie to custom event log.vbs: -------------------------------------------------------------------------------- 1 | ' Write to a Custom Event Log Using EventCreate 2 | 3 | 4 | Set WshShell = WScript.CreateObject("WScript.Shell") 5 | 6 | strCommand = "eventcreate /T Error /ID 100 /L Scripts /D " & _ 7 |     Chr(34) & "Test event." & Chr(34) 8 | WshShell.Run strcommand 9 | -------------------------------------------------------------------------------- /Logs/Plaintext Logs/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Logs/Plaintext Logs/README.md -------------------------------------------------------------------------------- /Logs/Plaintext Logs/read fixed width column log.vbs: -------------------------------------------------------------------------------- 1 | ' Read a Fixed Width Column Log 2 | 3 | 4 | Const ForReading = 1 5 | 6 | Set objFSO = CreateObject("Scripting.FileSystemObject") 7 | Set objTextFile = objFSO.OpenTextFile("C:\Windows\Debug\Netsetup.log", _ 8 |     ForReading) 9 | 10 | Do While objTextFile.AtEndOfStream <> True 11 |     strLinetoParse = objTextFile.ReadLine 12 |     dtmEventDate = Mid(strLinetoParse, 1, 6) 13 |     dtmEventTime = Mid(strLinetoParse, 7, 9) 14 |     strEventDescription = Mid(strLinetoParse, 16) 15 |     Wscript.Echo "Date: " & dtmEventDate 16 |     Wscript.Echo "Time: " & dtmEventTime 17 |     Wscript.Echo "Description: " & strEventDescription & VbCrLf 18 | Loop 19 | objFSO.Close 20 | -------------------------------------------------------------------------------- /Logs/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Logs/README.md -------------------------------------------------------------------------------- /Mathematics/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Mathematics/README.md -------------------------------------------------------------------------------- /Mathematics/calculation.vbs: -------------------------------------------------------------------------------- 1 | Dim ii, sOperator, strExpr, y 2 | strExpr = inputbox("Calculation", "Calculator", "1+1") 3 | 4 | ' insert spaces around all operators 5 | For Each sOperator in Array("+","-","*","/","%") 6 | strExpr = Trim( Replace( strExpr, sOperator, Space(1) & sOperator & Space(1))) 7 | Next 8 | ' replace all multi spaces with a single space 9 | Do While Instr( strExpr, Space(2)) 10 | strExpr = Trim( Replace( strExpr, Space(2), Space(1))) 11 | Loop 12 | -------------------------------------------------------------------------------- /Memory/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Memory/README.md -------------------------------------------------------------------------------- /Memory/list device memory address.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Device Memory Addresses 3 | 4 | 5 | On Error Resume Next 6 | 7 | strComputer = "." 8 | Set objWMIService = GetObject("winmgmts:" _ 9 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 10 | 11 | Set colItems = objWMIService.ExecQuery _ 12 |     ("Select * from Win32_DeviceMemoryAddress") 13 | 14 | For Each objItem in colItems 15 |     Wscript.Echo "Ending Address: " & objItem.EndingAddress 16 |     Wscript.Echo "Name: " & objItem.Name 17 |     Wscript.Echo "Starting Address: " & objItem.StartingAddress 18 |     Wscript.Echo 19 | Next 20 | -------------------------------------------------------------------------------- /Memory/list memory information: -------------------------------------------------------------------------------- 1 | ' List Memory Array Information 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery("Select * from Win32_MemoryArray") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Device ID: " & objItem.DeviceID 14 |     Wscript.Echo "Ending Address: " & objItem.EndingAddress 15 |     Wscript.Echo "Starting Address: " & objItem.StartingAddress 16 |     Wscript.Echo 17 | Next 18 | 19 | -------------------------------------------------------------------------------- /Memory/memory devices.vbs: -------------------------------------------------------------------------------- 1 | ' List Memory Devices 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery("Select * from Win32_MemoryDevice") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Device ID: " & objItem.DeviceID 14 |     Wscript.Echo "Ending Address: " & objItem.EndingAddress 15 |     Wscript.Echo "Starting Address: " & objItem.StartingAddress 16 |     Wscript.Echo 17 | Next 18 | -------------------------------------------------------------------------------- /Memory/physical memory properties.vbs: -------------------------------------------------------------------------------- 1 | ' List Physical Memory Properties 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery _ 11 |     ("Select * from Win32_PhysicalMemoryArray") 12 | 13 | For Each objItem in colItems 14 |     Wscript.Echo "Description: " & objItem.Description 15 |     Wscript.Echo "Maximum Capacity: " & objItem.MaxCapacity 16 |     Wscript.Echo "Memory Devices: " & objItem.MemoryDevices 17 |     Wscript.Echo "Memory Error Correction: " & objItem.MemoryErrorCorrection 18 | Next 19 | -------------------------------------------------------------------------------- /Microsoft Exchange Server/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Microsoft Exchange Server/README.md -------------------------------------------------------------------------------- /Microsoft Exchange Server/exchange schedule interval info.vbs: -------------------------------------------------------------------------------- 1 | ' List  Exchange Schedule Interval Information 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & _ 9 |         "\ROOT\MicrosoftExchangeV2") 10 | 11 | Set colItems = objWMIService.ExecQuery _ 12 |     ("Select * from Exchange_ScheduleInterval") 13 | 14 | For Each objItem in colItems 15 |     Wscript.Echo "Start time: " & objItem.StartTime 16 |     Wscript.Echo "Stop time: " & objItem.StopTime 17 |     Wscript.Echo 18 | Next 19 | -------------------------------------------------------------------------------- /Microsoft Exchange Server/exchange xml queue data.vbs: -------------------------------------------------------------------------------- 1 | ' List Exchange XML Queue Data 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & _ 9 |         "\ROOT\MicrosoftExchangeV2") 10 | 11 | Set colItems = objWMIService.ExecQuery _ 12 |     ("Select * from Exchange_QueueData") 13 | 14 | For Each objItem in colItems 15 |     Wscript.Echo "Server name: " & objItem.ServerName 16 |     Wscript.Echo "XML queue data: " & objItem.XMLQueueData 17 |     Wscript.Echo 18 | Next 19 | -------------------------------------------------------------------------------- /Microsoft Exchange Server/queue cached reload time.vbs: -------------------------------------------------------------------------------- 1 | ' List the Queued Cache Reload Time 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & _ 9 |         "\ROOT\MicrosoftExchangeV2") 10 | 11 | Set colItems = objWMIService.ExecQuery _ 12 |     ("Select * from Exchange_QueueCacheReloadEvent") 13 | 14 | For Each objItem in colItems 15 |     Wscript.Echo "Reload time: " & objItem.ReloadTime 16 |     Wscript.Echo 17 | Next 18 | 19 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Microsoft Office/Excel/README.md -------------------------------------------------------------------------------- /Microsoft Office/Excel/add data to cell.vbs: -------------------------------------------------------------------------------- 1 | ' Add Data to a Spreadsheet Cell 2 | 3 | 4 | 5 | Set objExcel = CreateObject("Excel.Application") 6 | 7 | objExcel.Visible = True 8 | objExcel.Workbooks.Add 9 | objExcel.Cells(1, 1).Value = "Test value" 10 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/autoformat to spreadsheet.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Apply an AutoFormat to an Excel Spreadsheet 3 | 4 | 5 | 6 | Const xpRangeAutoFormatList2 = 11 7 | 8 | Set objExcel = CreateObject("Excel.Application") 9 | objExcel.Visible = True 10 | Set objWorkbook = objExcel.Workbooks.Add() 11 | Set objWorksheet = objWorkbook.Worksheets(1) 12 | k = 1 13 | For i = 1 to 10 14 |     For j = 1 to 10 15 |         objWorksheet.Cells(i,j) = k 16 |         k = k + 1 17 |     Next 18 | Next 19 | 20 | Set objRange = objWorksheet.UsedRange 21 | objRange.AutoFormat(xpRangeAutoFormatList2) 22 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/formatted data.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Add Formatted Data to a Spreadsheet 3 | 4 | 5 | 6 | Set objExcel = CreateObject("Excel.Application") 7 | 8 | objExcel.Visible = True 9 | objExcel.Workbooks.Add 10 | objExcel.Cells(1, 1).Value = "Test value" 11 | objExcel.Cells(1, 1).Font.Bold = TRUE 12 | objExcel.Cells(1, 1).Font.Size = 24 13 | objExcel.Cells(1, 1).Font.ColorIndex = 3 14 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/list excel color values.vbs: -------------------------------------------------------------------------------- 1 | ' List Excel Color Values 2 | 3 | 4 | Set objExcel = CreateObject("Excel.Application") 5 | 6 | objExcel.Visible = True 7 | objExcel.Workbooks.Add 8 | 9 | For i = 1 to 56 10 |     objExcel.Cells(i, 1).Value = i 11 |     objExcel.Cells(i, 1).Interior.ColorIndex = i 12 | Next 13 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/list service data.vbs: -------------------------------------------------------------------------------- 1 | ' List Service Data in a Spreadsheet 2 | 3 | 4 | Set objExcel = CreateObject("Excel.Application") 5 | objExcel.Visible = True 6 | objExcel.Workbooks.Add 7 | 8 | x = 1 9 | strComputer = "." 10 | Set objWMIService = GetObject _ 11 |     ("winmgmts:\\" & strComputer & "\root\cimv2") 12 | Set colServices = objWMIService.ExecQuery _ 13 |     ("Select * From Win32_Service") 14 | 15 | For Each objService in colServices 16 |     objExcel.Cells(x, 1) = objService.Name 17 |     objExcel.Cells(x, 2) = objService.State 18 |     x = x + 1 19 | Next 20 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/open spreadsheet.vbs: -------------------------------------------------------------------------------- 1 | ' Open an Excel Spreadsheet 2 | 3 | 4 | Set objExcel = CreateObject("Excel.Application") 5 | Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\New_users.xls") 6 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/read spreadsheet.vbs: -------------------------------------------------------------------------------- 1 | ' Read an Excel Spreadsheet 2 | 3 | 4 | Set objExcel = CreateObject("Excel.Application") 5 | Set objWorkbook = objExcel.Workbooks.Open _ 6 |     ("C:\Scripts\New_users.xls") 7 | 8 | intRow = 2 9 | 10 | Do Until objExcel.Cells(intRow,1).Value = "" 11 |     Wscript.Echo "CN: " & objExcel.Cells(intRow, 1).Value 12 |     Wscript.Echo "sAMAccountName: " & objExcel.Cells(intRow, 2).Value 13 |     Wscript.Echo "GivenName: " & objExcel.Cells(intRow, 3).Value 14 |     Wscript.Echo "LastName: " & objExcel.Cells(intRow, 4).Value 15 |     intRow = intRow + 1 16 | Loop 17 | 18 | objExcel.Quit 19 | -------------------------------------------------------------------------------- /Microsoft Office/Excel/sort worksheet.vbs: -------------------------------------------------------------------------------- 1 | ' Sort a Microsoft Excel Worksheet 2 | 3 | 4 | 5 | Set objExcel = CreateObject("Excel.Application") 6 | objExcel.Visible = True 7 | Set objWorkbook = objExcel.Workbooks.Add 8 | Set objWorksheet = objWorkbook.Worksheets(1) 9 | 10 | objExcel.Cells(1, 1).Value = "4" 11 | objExcel.Cells(2, 1).Value = "1" 12 | objExcel.Cells(3, 1).Value = "2" 13 | objExcel.Cells(4, 1).Value = "3" 14 | objExcel.Cells(1, 2).Value = "A" 15 | objExcel.Cells(2, 2).Value = "B" 16 | objExcel.Cells(3, 2).Value = "C" 17 | objExcel.Cells(4, 2).Value = "D" 18 | 19 | Set objRange = objWorksheet.UsedRange 20 | Set objRange2 = objExcel.Range("A1") 21 | objRange.Sort(objRange2) 22 | -------------------------------------------------------------------------------- /Microsoft Office/Powerpoint/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Microsoft Office/Powerpoint/README.md -------------------------------------------------------------------------------- /Microsoft Office/Powerpoint/add slide to pptx.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Add a Slide to a Microsoft PowerPoint Presentation 3 | 4 | 5 | 6 | Const ppLayoutText = 2 7 | 8 | Set objPPT = CreateObject("PowerPoint.Application") 9 | objPPT.Visible = True 10 | 11 | Set objPresentation = objPPT.Presentations.Add 12 | 13 | objPresentation.ApplyTemplate _ 14 |     ("C:\Program Files\Microsoft Office\" & _ 15 |         "Templates\Presentation Designs\Globe.pot") 16 | 17 | Set objSlide = objPresentation.Slides.Add _ 18 |     (1, ppLayoutText) 19 | -------------------------------------------------------------------------------- /Microsoft Office/Powerpoint/shape found on pptx.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List the Shapes Found on a Microsoft PowerPoint Slide 3 | 4 | 5 | 6 | Const ppLayoutText = 2 7 | 8 | Set objPPT = CreateObject("PowerPoint.Application") 9 | objPPT.Visible = True 10 | Set objPresentation = objPPT.Presentations.Add 11 | objPresentation.ApplyTemplate _ 12 |     ("C:\Program Files\Microsoft Office\" & _ 13 |         "Templates\Presentation Designs\Globe.pot") 14 | Set objSlide = objPresentation.Slides.Add(1, ppLayoutText) 15 | 16 | Set objShapes = objSlide.Shapes 17 | 18 | For Each objShape in objShapes 19 |     Wscript.Echo objShape.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Microsoft Office/Powerpoint/shapes found on pptx slide.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List the Shapes Found on a Microsoft PowerPoint Slide 3 | 4 | 5 | 6 | Const ppLayoutText = 2 7 | 8 | Set objPPT = CreateObject("PowerPoint.Application") 9 | objPPT.Visible = True 10 | Set objPresentation = objPPT.Presentations.Add 11 | objPresentation.ApplyTemplate _ 12 |     ("C:\Program Files\Microsoft Office\" & _ 13 |         "Templates\Presentation Designs\Globe.pot") 14 | Set objSlide = objPresentation.Slides.Add(1, ppLayoutText) 15 | 16 | Set objShapes = objSlide.Shapes 17 | 18 | For Each objShape in objShapes 19 |     Wscript.Echo objShape.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Microsoft Office/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Microsoft Office/README.md -------------------------------------------------------------------------------- /Microsoft Office/Word/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Microsoft Office/Word/README.md -------------------------------------------------------------------------------- /Microsoft Office/Word/add formatted text.vbs: -------------------------------------------------------------------------------- 1 | ' Add Formatted Text to a Word Document 2 | 3 | 4 | Set objWord = CreateObject("Word.Application") 5 | 6 | objWord.Visible = True 7 | Set objDoc = objWord.Documents.Add() 8 | Set objSelection = objWord.Selection 9 | 10 | objSelection.Font.Name = "Arial" 11 | objSelection.Font.Size = "18" 12 | objSelection.TypeText "Network Adapter Report" 13 | objSelection.TypeParagraph() 14 | 15 | objSelection.Font.Size = "14" 16 | objSelection.TypeText "" & Date() 17 | objSelection.TypeParagraph() 18 | -------------------------------------------------------------------------------- /Microsoft Office/Word/append text.vbs: -------------------------------------------------------------------------------- 1 | ' Append Text to a Word Document 2 | 3 | 4 | Const END_OF_STORY = 6 5 | Const MOVE_SELECTION = 0 6 | 7 | Set objWord = CreateObject("Word.Application") 8 | objWord.Visible = True 9 | 10 | Set objDoc = objWord.Documents.Open("c:\scripts\word\testdoc.doc") 11 | Set objSelection = objWord.Selection 12 | objSelection.EndKey END_OF_STORY, MOVE_SELECTION 13 | 14 | objSelection.TypeParagraph() 15 | objSelection.TypeParagraph() 16 | 17 | objSelection.Font.Size = "14" 18 | objSelection.TypeText "" & Date() 19 | objSelection.TypeParagraph() 20 | objSelection.TypeParagraph() 21 | 22 | objSelection.Font.Size = "10" 23 | -------------------------------------------------------------------------------- /Microsoft Office/Word/bookmarks.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Read a Bookmark in a Word Document 3 | 4 | 5 | Set objWord = CreateObject("Word.Application") 6 | Set objDoc = objWord.Documents.Open("c:\scripts\word\bookmarkdoc.doc") 7 | Set objRange = objDoc.Bookmarks("NameBookmark").Range 8 | 9 | Wscript.Echo objRange.Text 10 | 11 | Set objRange = objDoc.Bookmarks("AddressBookmark").Range 12 | Wscript.Echo objRange.Text 13 | 14 | objWord.Quit 15 | -------------------------------------------------------------------------------- /Microsoft Office/Word/create doc.vbs: -------------------------------------------------------------------------------- 1 | ' Create a New Word Document 2 | 3 | 4 | Set objWord = CreateObject("Word.Application") 5 | objWord.Visible = True 6 | Set objDoc = objWord.Documents.Add() 7 | -------------------------------------------------------------------------------- /Microsoft Office/Word/file search.vbs: -------------------------------------------------------------------------------- 1 | ' Use Word to Search for Files 2 | 3 | 4 | Set objWord = CreateObject("Word.Application") 5 | Set objDoc = objWord.Documents.Add() 6 | 7 | objWord.FileSearch.FileName = "*.mp3" 8 | objWord.FileSearch.LookIn = "C:\" 9 | objWord.FileSearch.SearchSubfolders = True 10 | objWord.FileSearch.Execute 11 | 12 | For Each objFile in objWord.FileSearch.FoundFiles 13 |     Wscript.Echo objFile 14 | Next 15 | 16 | objWord.Quit 17 | -------------------------------------------------------------------------------- /Microsoft Office/Word/format paragraphs.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Format Paragraphs in Microsoft Word 3 | 4 | 5 | 6 | Const CENTERED = 1 7 | 8 | Set objWord = CreateObject("Word.Application") 9 | objWord.Visible = True 10 | Set objDoc = objWord.Documents.Add() 11 | Set objSelection = objWord.Selection 12 | 13 | objSelection.ParagraphFormat.Alignment = CENTERED 14 | objSelection.ParagraphFormat.LineSpacing = 36 15 | 16 | objSelection.Font.Name = "Arial" 17 | objSelection.Font.Size = "18" 18 | objSelection.TypeText "Here is some text typed in. " 19 | objSelection.TypeText "Here is some more text typed in. " 20 | objSelection.TypeText "Here is even more text typed in. " 21 | objSelection.TypeText "This is the last of the text." 22 | -------------------------------------------------------------------------------- /Microsoft Office/Word/modify bookmark text.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Bookmark Text in a Word Document 2 | 3 | 4 | Set objWord = CreateObject("Word.Application") 5 | objWord.Caption = "Test Caption" 6 | objWord.Visible = True 7 | 8 | Set objDoc = objWord.Documents.Open("c:\scripts\word\bookmarkdoc.doc") 9 | 10 | Set objRange = objDoc.Bookmarks("NameBookmark").Range 11 | objRange.Text = "Bob" 12 | 13 | Set objRange = objDoc.Bookmarks("AddressBookmark").Range 14 | objRange.Text = "999" 15 | -------------------------------------------------------------------------------- /Microsoft Office/Word/picture to word doc.vbs: -------------------------------------------------------------------------------- 1 | ' Add a Picture to a Microsoft Word Document 2 | 3 | 4 | 5 | Set objWord = CreateObject("Word.Application") 6 | objWord.Visible = True 7 | Set objDoc = objWord.Documents.Add() 8 | Set objSelection = objWord.Selection 9 | 10 | Set objShape = objDoc.Shapes 11 | objShape.AddPicture("C:\Scripts\Logo.jpg") 12 | -------------------------------------------------------------------------------- /Microsoft Office/Word/print.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Open and Print a Word Document 4 | 5 | 6 | Set objWord = CreateObject("Word.Application") 7 | Set objDoc = objWord.Documents.Open("c:\scripts\inventory.doc") 8 | 9 | objDoc.PrintOut() 10 | objWord.Quit 11 | -------------------------------------------------------------------------------- /Microsoft Office/Word/quit without saving.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Quit Microsoft Word Without Saving the Document 3 | 4 | 5 | 6 | Set objWord = CreateObject("Word.Application") 7 | objWord.Visible = True 8 | Set objDoc = objWord.Documents.Add() 9 | Set objSelection = objWord.Selection 10 | objSelection.TypeText "ABCDEFGHIJKLM" 11 | 12 | objDoc.Saved = TRUE 13 | objWord.Quit 14 | -------------------------------------------------------------------------------- /Microsoft Office/Word/word doc to html.vbs: -------------------------------------------------------------------------------- 1 | ' Save a Microsoft Word Document as an HTML File 2 | 3 | 4 | 5 | Const wdFormatHTML = 8 6 | 7 | Set objWord = CreateObject("Word.Application") 8 | objWord.Visible = True 9 | Set objDoc = _ 10 |     objWord.Documents.Open("c:\scripts\test.doc) 11 | objDoc.SaveAs("C:\Scripts\test.htm", wdFormatHTML) 12 | -------------------------------------------------------------------------------- /Microsoft Office/Word/word version.vbs: -------------------------------------------------------------------------------- 1 | ' Determine the Version of Microsoft Word Installed on a Computer 2 | 3 | 4 | 5 | Set objWord = CreateObject("Word.Application") 6 | Wscript.Echo "Version: " & objWord.Version 7 | Wscript.Echo "Build: " & objWord.Build 8 | Wscript.Echo "Product Code: " & _ 9 |     objWord.ProductCode() 10 | objWord.Quit 11 | 12 | -------------------------------------------------------------------------------- /Monitoring Hardware/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Monitoring Hardware/README.md -------------------------------------------------------------------------------- /Monitoring Hardware/available memory.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Monitor Available Memory 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 8 | set objRefresher = CreateObject("WbemScripting.SWbemRefresher") 9 | Set objMemory = objRefresher.AddEnum _ 10 |     (objWMIService, "Win32_PerfFormattedData_PerfOS_Memory").objectSet 11 | objRefresher.Refresh 12 | 13 | Do 14 |     For Each intAvailableBytes in objMemory 15 |         If intAvailableBytes.AvailableMBytes < 4 Then 16 |             Wscript.Echo "Available memory has fallen below 4 megabytes." 17 |         End If 18 |     Next 19 |     objRefresher.Refresh 20 | Loop 21 | -------------------------------------------------------------------------------- /Monitoring Hardware/changes in computer power status.vbs: -------------------------------------------------------------------------------- 1 | ' Monitor Changes in Computer Power Status 2 | 3 | 4 | Set objWMIService = GetObject("winmgmts:" _ 5 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 6 | Set colMonitoredEvents = objWMIService.ExecNotificationQuery _ 7 |     ("Select * from Win32_PowerManagementEvent") 8 | 9 | Do 10 |     Set strLatestEvent = colMonitoredEvents.NextEvent 11 |     Wscript.Echo strLatestEvent.EventType 12 | Loop 13 | -------------------------------------------------------------------------------- /Monitoring Hardware/verify computer availability.vbs: -------------------------------------------------------------------------------- 1 | ' Verify Computer Availability 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | Set colPingedComputers = objWMIService.ExecQuery _ 8 |     ("Select * from Win32_PingStatus Where Address = '192.168.1.37'") 9 | 10 | For Each objComputer in colPingedComputers 11 |     If objComputer.StatusCode = 0 Then 12 |         Wscript.Echo "Remote computer responded." 13 |     Else 14 |         Wscript.Echo "Remote computer did not respond." 15 |    End If 16 | Next 17 | -------------------------------------------------------------------------------- /Other/CalcDiffTime.vbs: -------------------------------------------------------------------------------- 1 | 2 | 'Check args 3 | Set objArgs = Wscript.Arguments 4 | If objArgs.Count <> 1 then 5 | WScript.ECHO "Error Args !!" 6 | WSCript.Quit 1 7 | End If 8 | 9 | 10 | fromDate=Wscript.Arguments(0) 11 | toDate=FormatDateTime(Now) 12 | 13 | wscript.echo DateDiff("s",fromDate,toDate) -------------------------------------------------------------------------------- /Other/GetCurrentTime.vbs: -------------------------------------------------------------------------------- 1 | wscript.echo FormatDateTime(Now) 2 | -------------------------------------------------------------------------------- /Other/HideCMD.vbs: -------------------------------------------------------------------------------- 1 | Const CONST_HIDE_WINDOW = 0 2 | Dim oShell, objArgs 3 | Dim strCmd 4 | Dim I 5 | 6 | strCmd = "" 7 | Set objArgs = WScript.Arguments 8 | For I = 0 To objArgs.Count - 1 9 | strCmd = strCmd & " " & objArgs(I) 10 | Next 11 | 12 | ' Run Command with hidden style 13 | Set oShell = WScript.CreateObject("WScript.shell") 14 | oShell.Run "CMD.exe /c " & strCmd, CONST_HIDE_WINDOW, TRUE 15 | Set oShell = Nothing 16 | 17 | WScript.Quit(0) 18 | -------------------------------------------------------------------------------- /Other/HideEXE.vbs: -------------------------------------------------------------------------------- 1 | Const CONST_HIDE_WINDOW = 0 2 | Dim oShell, objArgs 3 | Dim strCmd 4 | Dim I 5 | 6 | strCmd = "" 7 | Set objArgs = WScript.Arguments 8 | For I = 0 To objArgs.Count - 1 9 | strCmd = strCmd & " " & objArgs(I) 10 | Next 11 | 12 | strCmd = Trim(strCmd) 13 | 14 | ' Run Command with hidden style 15 | Set oShell = WScript.CreateObject("WScript.shell") 16 | oShell.Run strCmd, CONST_HIDE_WINDOW, TRUE 17 | Set oShell = Nothing 18 | 19 | WScript.Quit(0) 20 | -------------------------------------------------------------------------------- /Other/Lhidecmd.vbs: -------------------------------------------------------------------------------- 1 | Const CONST_HIDE_WINDOW = 0 2 | Dim oShell, objArgs 3 | Dim strCmd 4 | Dim I 5 | 6 | strCmd = "" 7 | Set objArgs = WScript.Arguments 8 | For I = 0 To objArgs.Count - 1 9 | strCmd = strCmd & " " & objArgs(I) 10 | Next 11 | 12 | ' Run Command with hidden style 13 | Set oShell = WScript.CreateObject("WScript.shell") 14 | oShell.Run "CMD.exe /c " & strCmd, CONST_HIDE_WINDOW, TRUE 15 | Set oShell = Nothing 16 | 17 | ' Delete myself 18 | Dim objFSO 19 | Set objFSO = CreateObject("Scripting.FileSystemObject") 20 | objFSO.DeleteFile(WScript.ScriptFullName) 21 | 22 | -------------------------------------------------------------------------------- /Other/RunCmd.vbs: -------------------------------------------------------------------------------- 1 | 'dim driveRP, pathPatch, isDebug 2 | set oArgs = wscript.arguments 3 | if oArgs.count <> 1 then 4 | wscript.echo "DetectDrv error args" 5 | wscript.quit 1 6 | end if 7 | 8 | CMDPath=chr(34) & oArgs(0) & chr(34) 9 | 10 | Dim wshell, CMDResult 11 | 'On Error Resume Next 12 | CMDResult=99 13 | set wshell = CreateObject("WScript.Shell") 14 | CMDResult = wshell.run (CMDPath, 0, True) 15 | wscript.quit CMDResult 16 | 17 | -------------------------------------------------------------------------------- /Other/SafeMode.vbs: -------------------------------------------------------------------------------- 1 | If WScript.Arguments.length = 0 Then 2 | Set objShell = CreateObject("Shell.Application") 3 | objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1 4 | Else 5 | Set objShell2 = WScript.CreateObject("WScript.Shell") 6 | objShell2.Run "bcdedit /set {current} safeboot minimal",0,True 7 | objShell2.Run "shutdown -r -t 0 -f", 0, True 8 | End If 9 | set objShell = nothing 10 | set objShell2 = nothing -------------------------------------------------------------------------------- /Other/SafeModeCommandPrompt.vbs: -------------------------------------------------------------------------------- 1 | If WScript.Arguments.length = 0 Then 2 | Set objShell = CreateObject("Shell.Application") 3 | objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1 4 | Else 5 | Set objShell2 = WScript.CreateObject("WScript.Shell") 6 | objShell2.Run "bcdedit /set {current} safeboot minimal",0,True 7 | objShell2.Run "bcdedit /set {current} safebootalternateshell yes",0,True 8 | objShell2.Run "shutdown -r -t 0 -f", 0, True 9 | End If 10 | set objShell = nothing 11 | set objShell2 = nothing -------------------------------------------------------------------------------- /Other/SafeModeNetworking.vbs: -------------------------------------------------------------------------------- 1 | If WScript.Arguments.length = 0 Then 2 | Set objShell = CreateObject("Shell.Application") 3 | objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1 4 | Else 5 | Set objShell2 = WScript.CreateObject("WScript.Shell") 6 | objShell2.Run "bcdedit /set {current} safeboot network",0,True 7 | objShell2.Run "shutdown -r -t 0 -f", 0, True 8 | End If 9 | set objShell = nothing 10 | set objShell2 = nothing -------------------------------------------------------------------------------- /Other/SafeModeNormalMode.vbs: -------------------------------------------------------------------------------- 1 | If WScript.Arguments.length = 0 Then 2 | Set objShell = CreateObject("Shell.Application") 3 | objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1 4 | Else 5 | Set objShell2 = WScript.CreateObject("WScript.Shell") 6 | objShell2.Run "bcdedit /deletevalue {current} safeboot",0,True 7 | objShell2.Run "bcdedit /deletevalue {current} safebootalternateshell",0,True 8 | objShell2.Run "shutdown -r -t 0 -f", 0, True 9 | End If 10 | set objShell = nothing 11 | set objShell2 = nothing -------------------------------------------------------------------------------- /Other/WallpaperPath.vbs: -------------------------------------------------------------------------------- 1 | Const HKCU = &H80000001 'HKEY_CURRENT_USER 2 | 3 | sComputer = "." 4 | 5 | Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ 6 | & sComputer & "\root\default:StdRegProv") 7 | 8 | sKeyPath = "Control Panel\Desktop\" 9 | sValueName = "TranscodedImageCache" 10 | oReg.GetBinaryValue HKCU, sKeyPath, sValueName, sValue 11 | 12 | 13 | sContents = "" 14 | 15 | For i = 24 To UBound(sValue) 16 | vByte = sValue(i) 17 | If vByte <> 0 And vByte <> "" Then 18 | sContents = sContents & Chr(vByte) 19 | End If 20 | Next 21 | 22 | CreateObject("Wscript.Shell").Run "explorer.exe /select,""" & sContents & """" -------------------------------------------------------------------------------- /Other/_sleep.vbs: -------------------------------------------------------------------------------- 1 | WScript.Echo "wait " & WScript.Arguments.Item(0) & "seconds" 2 | WScript.Echo "Wait START on " & Now() 3 | WScript.Sleep CDbl(WScript.Arguments.Item(0))*1000 4 | WScript.Echo "Wait END on " & Now() 5 | -------------------------------------------------------------------------------- /Other/debugTest.vbs: -------------------------------------------------------------------------------- 1 | a=1 2 | b=a 3 | Test.Echo "Hello from VBScript" 4 | ' Here is a comment 5 | for i = 1 to 10 6 | 7 | next 8 | -------------------------------------------------------------------------------- /Other/empty.vbs: -------------------------------------------------------------------------------- 1 | 'Empty VBS file, does nothing. Helper for Lib\test\test_startfile.py. -------------------------------------------------------------------------------- /Other/getdisksize.vbs: -------------------------------------------------------------------------------- 1 | 2 | set oArgs = wscript.arguments 3 | if oArgs.count <> 1 then 4 | wscript.echo "Error args !!" 5 | wscript.quit 1 6 | end if 7 | 8 | Dim DiskId, objWMIService, objItem, colItems 9 | DiskId = oArgs(0) 10 | 11 | Set objWMIService = GetObject ("winmgmts:\\.\root\Microsoft\Windows\Storage") 12 | Set colItems = objWMIService.ExecQuery ("Select * from MSFT_PhysicalDisk where DeviceId=" & DiskId) 13 | 14 | For Each objItem in colItems 15 | ' echo size in GB base 16 | wscript.echo "Size=" & CLng(objItem.Size/1024/1024/1024) 17 | Next 18 | 19 | wscript.quit 0 -------------------------------------------------------------------------------- /Other/green.vbs: -------------------------------------------------------------------------------- 1 | Set ws = CreateObject("Wscript.Shell") 2 | ws.run "cmd /c green.bat",0 -------------------------------------------------------------------------------- /Other/prncnfg.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/prncnfg.vbs -------------------------------------------------------------------------------- /Other/prndrvr.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/prndrvr.vbs -------------------------------------------------------------------------------- /Other/prnjobs.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/prnjobs.vbs -------------------------------------------------------------------------------- /Other/prnmngr.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/prnmngr.vbs -------------------------------------------------------------------------------- /Other/prnport.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/prnport.vbs -------------------------------------------------------------------------------- /Other/prnqctl.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/prnqctl.vbs -------------------------------------------------------------------------------- /Other/pubprn.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/pubprn.vbs -------------------------------------------------------------------------------- /Other/register_app.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Other/register_app.vbs -------------------------------------------------------------------------------- /Other/shutdown.vbs: -------------------------------------------------------------------------------- 1 | dim objShell 2 | set objShell = CreateObject("shell.application") 3 | objshell.ShutdownWindows 4 | set objShell = nothing -------------------------------------------------------------------------------- /Other/testDictionary.vbs: -------------------------------------------------------------------------------- 1 | ' Test Pyhon.Dictionary using VBScript - this uses 2 | ' IDispatchEx, so is an interesting test. 3 | 4 | set ob = CreateObject("Python.Dictionary") 5 | ob("hello") = "there" 6 | ' Our keys are case insensitive. 7 | ob.Item("hi") = ob("HELLO") 8 | 9 | dim ok 10 | ok = true 11 | 12 | if ob("hello") <> "there" then 13 | WScript.Echo "**** The dictionary value was wrong!!" 14 | ok = false 15 | end if 16 | 17 | if ob("hi") <> "there" then 18 | WScript.Echo "**** The other dictionary value was wrong!!" 19 | ok = false 20 | end if 21 | 22 | if ok then 23 | WScript.Echo "VBScript has successfully tested Python.Dictionary" 24 | end if 25 | 26 | 27 | -------------------------------------------------------------------------------- /Other/testInterp.vbs: -------------------------------------------------------------------------------- 1 | set o = CreateObject("Python.Interpreter") 2 | if o.Eval("1+1") <> 2 Then 3 | WScript.Echo "Eval('1+1') failed" 4 | bFailed = True 5 | end if 6 | 7 | if bFailed then 8 | WScript.Echo "*********** VBScript tests failed *********" 9 | else 10 | WScript.Echo "VBScript test worked OK" 11 | end if 12 | 13 | -------------------------------------------------------------------------------- /Peripherals and Devices/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Peripherals and Devices/README.md -------------------------------------------------------------------------------- /Ports and Slots/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Ports and Slots/README.md -------------------------------------------------------------------------------- /Ports and Slots/port resource info.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Port Resource Information 3 | 4 | 5 | On Error Resume Next 6 | 7 | strComputer = "." 8 | Set objWMIService = GetObject("winmgmts:" _ 9 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 10 | 11 | Set colItems = objWMIService.ExecQuery("Select * from Win32_PortResource") 12 | 13 | For Each objItem in colItems 14 |     Wscript.Echo "Alias: " & objItem.Alias 15 |     Wscript.Echo "Ending Address: " & objItem.EndingAddress 16 |     Wscript.Echo "Name: " & objItem.Name 17 |     Wscript.Echo "Starting Address: " & objItem.StartingAddress 18 |     Wscript.Echo 19 | Next 20 | 21 | -------------------------------------------------------------------------------- /Power Supply and Batteries/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Power Supply and Batteries/README.md -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Versions will not be updated probably. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Report vulnerabilities in issues or as a pull requests. 10 | 11 | ## Contributing 12 | Making a pull requests. 13 | -------------------------------------------------------------------------------- /SMTP Mail/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/SMTP Mail/README.md -------------------------------------------------------------------------------- /SMTP Mail/send email from script.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Send Email from a Script 3 | 4 | 5 | Set objEmail = CreateObject("CDO.Message") 6 | 7 | objEmail.From = "monitor1@fabrikam.com" 8 | objEmail.To = "admin1@fabrikam.com" 9 | objEmail.Subject = "Atl-dc-01 down" 10 | objEmail.Textbody = "Atl-dc-01 is no longer accessible over the network." 11 | objEmail.Send 12 | -------------------------------------------------------------------------------- /Special Folders/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Special Folders/README.md -------------------------------------------------------------------------------- /Special Folders/all.vbs: -------------------------------------------------------------------------------- 1 | ' List All Special Folders in Windows  2 | 3 | Set objShell = CreateObject("Shell.Application") 4 | 5 | For i=0 to 255 6 | 7 |   Set objFolder = objShell.Namespace(i) 8 | 9 |   On Error Resume next 10 |   Set objFolderItem = objFolder.Self 11 |   On Error Resume Next 12 |   WScript.Echo i & " " &  objFolder.Title & " " & objFolderItem.Path 13 |   Set objFolder=Nothing 14 |    15 | Next 16 | -------------------------------------------------------------------------------- /Special Folders/applicaiton data.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Application Data" folder 3 | 4 | Const CSIDL_APPDATA = &H1a 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_APPDATA) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/application data.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Application Data" folder 3 | 4 | Const CSIDL_APPDATA = &H1a 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_APPDATA) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/cd burning.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "CD Burning" folder 3 | 4 | Const CSIDL_CDBURN_AREA = &H3b 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_CDBURN_AREA) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/common admin tools.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Administrative Tools" folder 2 | 3 | Const CSIDL_COMMON_ADMINTOOLS = &H2f 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_ADMINTOOLS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common application data.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Application Data" folder 2 | 3 | Const CSIDL_COMMON_APPDATA = &H23 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_APPDATA) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common desktop.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Common Desktop" folder 3 | 4 | Const CSIDL_COMMON_DESKTOPDIRECTORY = &H19 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_COMMON_DESKTOPDIRECTORY) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/common documents.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Common Documents" folder 3 | 4 | Const CSIDL_COMMON_DOCUMENTS = &H2e 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_COMMON_DOCUMENTS) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/common favourites.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List Items in the "Common Favorites" folder 4 | 5 | Const CSIDL_COMMON_FAVORITES = &H1f 6 | 7 | Set objShell = CreateObject("Shell.Application") 8 | Set objFolder = objShell.Namespace(CSIDL_COMMON_FAVORITES) 9 | Set objFolderItem = objFolder.Self 10 | Wscript.Echo objFolderItem.Path 11 | 12 | Set fso = CreateObject("Scripting.Filesystemobject") 13 | 14 | Set folder=fso.GetFolder(objFolderItem.Path) 15 | 16 | For Each subfolder in folder.SubFolders 17 |   WScript.Echo "[" & subfolder.Name & "]" 18 | Next 19 | 20 | For Each file in folder.Files 21 |   WScript.Echo file.Name 22 | Next 23 | -------------------------------------------------------------------------------- /Special Folders/common music.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Music" folder 2 | 3 | Const CSIDL_COMMON_MUSIC = &H35 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_MUSIC) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common pictures.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Pictures" folder 2 | 3 | Const CSIDL_COMMON_PICTURES = &H36 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_PICTURES) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common program files.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Program Files - Common" folder 2 | 3 | Const CSIDL_PROGRAM_FILES_COMMON = &H2b 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_PROGRAM_FILES_COMMON) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common start menu programs.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Start Menu Programs" folder 2 | 3 | Const CSIDL_COMMON_PROGRAMS = &H17 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_PROGRAMS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common startup.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Common Startup" folder 3 | 4 | Const CSIDL_COMMON_STARTUP = &H18 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_COMMON_STARTUP) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/common templates.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Templates" folder 2 | 3 | Const CSIDL_COMMON_TEMPLATES = &H2d 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_TEMPLATES) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/common video.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Common Video" folder 2 | 3 | Const CSIDL_COMMON_VIDEO = &H37 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_COMMON_VIDEO) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/control panel.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Control Panel" folder 2 | 3 | Const CONTROL_PANEL = &H3 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CONTROL_PANEL) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set colItems = objFolder.Items 11 | For Each objItem in colItems 12 |   Wscript.Echo objItem.Name 13 | Next 14 | 15 | 16 | -------------------------------------------------------------------------------- /Special Folders/cookies.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Cookies" folder 3 | 4 | Const CSIDL_COOKIES = &H21 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_COOKIES) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/desktop.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Desktop" folder 2 | 3 | Const CSIDL_DESKTOPDIRECTORY = &H10 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_DESKTOPDIRECTORY) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/fonts.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Fonts" folder 2 | 3 | Const CSIDL_FONTS = &H14 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_FONTS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/history.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List Items in the "History" folder 4 | 5 | Const CSIDL_HISTORY = &H22 6 | 7 | Set objShell = CreateObject("Shell.Application") 8 | Set objFolder = objShell.Namespace(CSIDL_HISTORY) 9 | Set objFolderItem = objFolder.Self 10 | Wscript.Echo objFolderItem.Path 11 | 12 | Set fso = CreateObject("Scripting.Filesystemobject") 13 | 14 | Set folder=fso.GetFolder(objFolderItem.Path) 15 | 16 | For Each subfolder in folder.SubFolders 17 |   WScript.Echo "[" & subfolder.Name & "]" 18 | Next 19 | 20 | For Each file in folder.Files 21 |   WScript.Echo file.Name 22 | Next 23 | -------------------------------------------------------------------------------- /Special Folders/internet explorer.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List Items in the "Internet Explorer" folder 4 | 5 | Const INTERNET_EXPLORER = &H1 6 | 7 | Set objShell = CreateObject("Shell.Application") 8 | Set objFolder = objShell.Namespace(INTERNET_EXPLORER) 9 | Set objFolderItem = objFolder.Self 10 | Wscript.Echo objFolderItem.Path 11 | 12 | Set colItems = objFolder.Items 13 | For Each objItem in colItems 14 |   Wscript.Echo objItem.Name 15 | Next 16 | -------------------------------------------------------------------------------- /Special Folders/internet favourites.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Internet Favorites" folder 2 | 3 | Const INTERNET_FAVORITES = &H6 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(INTERNET_FAVORITES) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | 22 | -------------------------------------------------------------------------------- /Special Folders/local application data.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Local Application Data" folder 2 | 3 | Const CSIDL_LOCAL_APPDATA = &H1c 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_LOCAL_APPDATA) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/my computer.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "My Computer" folder 2 | 3 | Const MY_COMPUTER = &H11 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(MY_COMPUTER) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set colItems = objFolder.Items 11 | For Each objItem in colItems 12 |   Wscript.Echo objItem.Name 13 | Next 14 | -------------------------------------------------------------------------------- /Special Folders/my documents.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "My Documents" folder 2 | 3 | Const MY_DOCUMENTS = &H5 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(MY_DOCUMENTS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/my music.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "My Music" folder 3 | 4 | Const MY_MUSIC = &Hd 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(MY_MUSIC) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | 23 | -------------------------------------------------------------------------------- /Special Folders/my pictures.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "My Pictures" folder 2 | 3 | Const CSIDL_MYPICTURES = &H27 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_MYPICTURES) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/my recent documents.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "My Recent Documents" folder 2 | 3 | Const MY_RECENT_DOCUMENTS = &H8 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(MY_RECENT_DOCUMENTS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/my videos.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "My Videos" folder 2 | 3 | Const MY_VIDEOS = &He 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(MY_VIDEOS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/nethood.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "NetHood" folder 2 | 3 | Const CSIDL_NETHOOD = &H13 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_NETHOOD) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/network connections.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Network Connections" folder 2 | 3 | Const NETWORK_CONNECTIONS = &H31 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set colItems = objFolder.Items 11 | For Each objItem in colItems 12 |   Wscript.Echo objItem.Name 13 | Next 14 | -------------------------------------------------------------------------------- /Special Folders/network places.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List Items in the "My Network Places" folder 4 | 5 | Const MY_NETWORK_PLACES = &H12 6 | 7 | Set objShell = CreateObject("Shell.Application") 8 | Set objFolder = objShell.Namespace(MY_NETWORK_PLACES) 9 | Set objFolderItem = objFolder.Self 10 | Wscript.Echo objFolderItem.Path 11 | 12 | Set colItems = objFolder.Items 13 | For Each objItem in colItems 14 |   Wscript.Echo objItem.Name 15 | Next 16 | -------------------------------------------------------------------------------- /Special Folders/printers and faxes.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ' List Items in the "Printers and Faxes" folder 5 | 6 | Const PRINTERS_AND_FAXES = &H4 7 | 8 | Set objShell = CreateObject("Shell.Application") 9 | Set objFolder = objShell.Namespace(PRINTERS_AND_FAXES) 10 | Set objFolderItem = objFolder.Self 11 | Wscript.Echo objFolderItem.Path 12 | 13 | Set colItems = objFolder.Items 14 | For Each objItem in colItems 15 |   Wscript.Echo objItem.Name 16 | Next 17 | 18 | -------------------------------------------------------------------------------- /Special Folders/printhood.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "PrintHood" folder 2 | 3 | Const CSIDL_PRINTHOOD = &H1b 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_PRINTHOOD) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/profile folder.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ' List Items in the "Profile Folder" folder 5 | 6 | Const CSIDL_PROFILE = &H28 7 | 8 | Set objShell = CreateObject("Shell.Application") 9 | Set objFolder = objShell.Namespace(CSIDL_PROFILE) 10 | Set objFolderItem = objFolder.Self 11 | Wscript.Echo objFolderItem.Path 12 | 13 | Set fso = CreateObject("Scripting.Filesystemobject") 14 | 15 | Set folder=fso.GetFolder(objFolderItem.Path) 16 | 17 | For Each subfolder in folder.SubFolders 18 |   WScript.Echo "[" & subfolder.Name & "]" 19 | Next 20 | 21 | For Each file in folder.Files 22 |   WScript.Echo file.Name 23 | Next 24 | 25 | -------------------------------------------------------------------------------- /Special Folders/program files.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Program Files" folder 3 | 4 | Const CSIDL_PROGRAM_FILES = &H26 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_PROGRAM_FILES) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/recycle bin.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Recycle Bin" folder 2 | 3 | Const RECYCLE_BIN = &Ha 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(RECYCLE_BIN) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set colItems = objFolder.Items 11 | For Each objItem in colItems 12 |   Wscript.Echo objItem.Name 13 | Next 14 | 15 | -------------------------------------------------------------------------------- /Special Folders/sendto.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "SendTo" folder 2 | 3 | Const SENDTO = &H9 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(SENDTO) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/start menu: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Common Start Menu" folder 3 | 4 | Const CSIDL_COMMON_STARTMENU = &H16 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_COMMON_STARTMENU) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/startmenu.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "Start Menu" folder 2 | 3 | Const START_MENU = &Hb 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(START_MENU) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/startup.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Startup" folder 3 | 4 | Const STARTUP = &H7 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(STARTUP) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/system directory.vbs: -------------------------------------------------------------------------------- 1 | ' List Items in the "System Directory" folder 2 | 3 | Const CSIDL_SYSTEM = &H25 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(CSIDL_SYSTEM) 7 | Set objFolderItem = objFolder.Self 8 | Wscript.Echo objFolderItem.Path 9 | 10 | Set fso = CreateObject("Scripting.Filesystemobject") 11 | 12 | Set folder=fso.GetFolder(objFolderItem.Path) 13 | 14 | For Each subfolder in folder.SubFolders 15 |   WScript.Echo "[" & subfolder.Name & "]" 16 | Next 17 | 18 | For Each file in folder.Files 19 |   WScript.Echo file.Name 20 | Next 21 | -------------------------------------------------------------------------------- /Special Folders/templates.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List Items in the "Templates" folder 4 | 5 | Const CSIDL_TEMPLATES = &H15 6 | 7 | Set objShell = CreateObject("Shell.Application") 8 | Set objFolder = objShell.Namespace(CSIDL_TEMPLATES) 9 | Set objFolderItem = objFolder.Self 10 | Wscript.Echo objFolderItem.Path 11 | 12 | Set fso = CreateObject("Scripting.Filesystemobject") 13 | 14 | Set folder=fso.GetFolder(objFolderItem.Path) 15 | 16 | For Each subfolder in folder.SubFolders 17 |   WScript.Echo "[" & subfolder.Name & "]" 18 | Next 19 | 20 | For Each file in folder.Files 21 |   WScript.Echo file.Name 22 | Next 23 | -------------------------------------------------------------------------------- /Special Folders/temporary internet files.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Temporary Internet Files" folder 3 | 4 | Const CSIDL_INTERNET_CACHE = &H20 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_INTERNET_CACHE) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Special Folders/windows directory.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Items in the "Windows Directory" folder 3 | 4 | Const CSIDL_WINDOWS = &H24 5 | 6 | Set objShell = CreateObject("Shell.Application") 7 | Set objFolder = objShell.Namespace(CSIDL_WINDOWS) 8 | Set objFolderItem = objFolder.Self 9 | Wscript.Echo objFolderItem.Path 10 | 11 | Set fso = CreateObject("Scripting.Filesystemobject") 12 | 13 | Set folder=fso.GetFolder(objFolderItem.Path) 14 | 15 | For Each subfolder in folder.SubFolders 16 |   WScript.Echo "[" & subfolder.Name & "]" 17 | Next 18 | 19 | For Each file in folder.Files 20 |   WScript.Echo file.Name 21 | Next 22 | -------------------------------------------------------------------------------- /Startup and Shutdown/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Startup and Shutdown/README.md -------------------------------------------------------------------------------- /Startup and Shutdown/modify recovery config options.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Recovery Configuration Options 2 | 3 | 4 | Const COMPLETE_MEMORY_DUMP = 1 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colRecoveryOptions = objWMIService.ExecQuery _ 11 |     ("Select * from Win32_OSRecoveryConfiguration") 12 | 13 | For Each objOption in colRecoveryOptions 14 |     objOption.DebugInfoType = COMPLETE_MEMORY_DUMP 15 |     objOption.DebugFilePath = "c:\scripts\memory.dmp" 16 |     objOption.OverWriteExistingDebugFile = False 17 |     objOption.Put_ 18 | Next 19 | 20 | -------------------------------------------------------------------------------- /Startup and Shutdown/modify system startup delay.vbs: -------------------------------------------------------------------------------- 1 | ' Modify System Startup Delay 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colStartupCommands = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_ComputerSystem") 10 | 11 | For Each objStartupCommand in colStartupCommands 12 |     objStartupCommand.SystemStartupDelay = 10 13 |     objStartupCommand.Put_ 14 | Next 15 | 16 | -------------------------------------------------------------------------------- /Startup and Shutdown/restart pc.vbs: -------------------------------------------------------------------------------- 1 | ' Restart a Computer 2 | 3 | 4 | strComputer = "atl-dc-01" 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ 7 |         strComputer & "\root\cimv2") 8 | 9 | Set colOperatingSystems = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_OperatingSystem") 11 | 12 | For Each objOperatingSystem in colOperatingSystems 13 |     objOperatingSystem.Reboot() 14 | Next 15 | -------------------------------------------------------------------------------- /Startup and Shutdown/shutdown pc.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Shut Down a Computer 4 | 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject_ 8 |     ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _ 9 |         strComputer & "\root\cimv2") 10 | 11 | Set colOperatingSystems = objWMIService.ExecQuery _ 12 |     ("Select * from Win32_OperatingSystem") 13 | 14 | For Each objOperatingSystem in colOperatingSystems 15 |     objOperatingSystem.Win32Shutdown(1) 16 | Next 17 | -------------------------------------------------------------------------------- /System Restore/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/System Restore/README.md -------------------------------------------------------------------------------- /System Restore/conduct system restore.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ' Conduct a System Restore 5 | 6 | 7 | Const RESTORE_POINT = 20 8 | 9 | strComputer = "." 10 | Set objWMIService = GetObject("winmgmts:" _ 11 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default") 12 | 13 | Set objItem = objWMIService.Get("SystemRestore") 14 | errResults = objItem.Restore(RESTORE_POINT) 15 | -------------------------------------------------------------------------------- /System Restore/create system restore point.vbs: -------------------------------------------------------------------------------- 1 | ' Create a System Restore Point 2 | 3 | 4 | CONST DEVICE_DRIVER_INSTALL = 10 5 | CONST BEGIN_SYSTEM_CHANGE = 100 6 | 7 | strComputer = "." 8 | Set objWMIService = GetObject("winmgmts:" _ 9 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default") 10 | 11 | Set objItem = objWMIService.Get("SystemRestore") 12 | errResults = objItem.CreateRestorePoint _ 13 |     ("Scripted restore", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE) 14 | -------------------------------------------------------------------------------- /System Restore/disable full system restore.vbs: -------------------------------------------------------------------------------- 1 | ' Disable Full System Restore 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default") 7 | 8 | Set objItem = objWMIService.Get("SystemRestore") 9 | errResults = objItem.Disable("") 10 | -------------------------------------------------------------------------------- /System Restore/enable full system restore.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Enable Full System Restore 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default") 8 | 9 | Set objItem = objWMIService.Get("SystemRestore") 10 | errResults = objItem.Enable("") 11 | -------------------------------------------------------------------------------- /System Restore/list results of previous system restore.vbs: -------------------------------------------------------------------------------- 1 | ' List the Results of the Last System Restore 2 | 3 | 4 | strComputer = "." 5 | 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default") 8 | 9 | Set objItem = objWMIService.Get("SystemRestore") 10 | errResults = objItem.GetLastRestoreStatus() 11 | 12 | Select Case errResults 13 |     Case 0 strRestoreStatus = "The last restore failed." 14 |     Case 1 strRestoreStatus = "The last restore was successful." 15 |     Case 2 strRestoreStatus = "The last restore was interrupted." 16 | End Select 17 | 18 | Wscript.Echo strRestoreStatus 19 | -------------------------------------------------------------------------------- /System Restore/modify system restore config values.vbs: -------------------------------------------------------------------------------- 1 | ' Modify System Restore Configuration Values 2 | 3 | 4 | Const GLOBAL_INTERVAL_IN_SECONDS = 100000 5 | Const LIFE_INTERVAL_IN_SECONDS = 8000000 6 | Const SESSION_INTERVAL_IN_SECONDS = 500000 7 | 8 | strComputer = "." 9 | Set objWMIService = GetObject("winmgmts:" _ 10 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default") 11 | 12 | Set objItem = objWMIService.Get("SystemRestoreConfig='SR'") 13 | objItem.DiskPercent = 10 14 | objItem.RPGlobalInterval = GLOBAL_INTERVAL_IN_SECONDS 15 | objItem.RPLifeInterval = LIFE_INTERVAL_IN_SECONDS 16 | objItem.RPSessionInterval = SESSION_INTERVAL_IN_SECONDS 17 | objItem.Put_ 18 | 19 | -------------------------------------------------------------------------------- /Video/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Video/README.md -------------------------------------------------------------------------------- /Windows Activation/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eggy115/VBScript/0b1a3d2d5dcafc591dd956f58e0e715bc79c2dba/Windows Activation/README.md -------------------------------------------------------------------------------- /Windows Activation/offline activation.vbs: -------------------------------------------------------------------------------- 1 | ' Activate Windows Offline 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colWindowsProducts = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_WindowsProductActivation") 10 | 11 | For Each objWindowsProduct in colWindowsProducts 12 |     objWindowsProduct.ActivateOffline("1234-1234") 13 | Next 14 | -------------------------------------------------------------------------------- /Windows Activation/online activation.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Activate Windows Online 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 8 | 9 | Set colWindowsProducts = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_WindowsProductActivation") 11 | 12 | For Each objWindowsProduct in colWindowsProducts 13 |     objWindowsProduct.ActivateOnline() 14 | Next 15 | -------------------------------------------------------------------------------- /Windows Activation/suppress notices.vbs: -------------------------------------------------------------------------------- 1 | ' Suppress Windows Activation Notices 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colWPASettings = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_WindowsProductActivation") 10 | 11 | For Each objWPASetting in colWPASettings 12 |     objWPASetting.SetNotification(0) 13 | Next 14 | -------------------------------------------------------------------------------- /add additional home phone number.vbs: -------------------------------------------------------------------------------- 1 | ' Add an Additional Home Phone Number to a User Account 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objUser = GetObject _ 7 |    ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_APPEND, "otherHomePhone", Array("(425) 555-0116") 10 | objUser.SetInfo 11 | -------------------------------------------------------------------------------- /add additional url to user account.vbs: -------------------------------------------------------------------------------- 1 | ' Add an Additional URL to a User Account 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_APPEND, _ 10 |     "url", Array("http://www.fabrikam.com/policy") 11 | objUser.SetInfo 12 | -------------------------------------------------------------------------------- /add route to user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Add a Route to the Dial-In Properties of a User Account 3 | 4 | 5 | Const ADS_PROPERTY_APPEND = 3 6 | 7 | Set objUser = GetObject _ 8 |    ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 9 | objUser.PutEx ADS_PROPERTY_APPEND, _ 10 |     "msRASSavedFramedRoute", _ 11 |         Array("128.168.0.0/15 0.0.0.0 5") 12 | objUser.PutEx ADS_PROPERTY_APPEND, _ 13 |     "msRADIUSFramedRoute", _ 14 |         Array("128.168.0.0/15 0.0.0.0 5") 15 | objUser.SetInfo 16 | -------------------------------------------------------------------------------- /add rows to access database.vbs: -------------------------------------------------------------------------------- 1 | ' Add new Rows to a table in a Microsoft Access Database  2 | 3 | Set objConn = CreateObject("ADODB.Connection") 4 | 5 | Set shell = CreateObject( "WScript.Shell" ) 6 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 7 | 8 | objConn.open "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & "mydatabase.accdb" 9 | 10 | Set oRS = CreateObject("ADODB.Recordset") 11 | Const adOpenKeyset = 1 12 | Const adLockOptimistic = 3 13 | oRS.Open "table1", objConn, adOpenKeyset, adLockOptimistic 14 | 15 | For i=0 to 10 16 |   oRS.AddNew 17 |   oRS("Field1") = "value_" & Int((100 * Rnd) + 1) 18 |   oRS.Update 19 | Next 20 | 21 | oRS.Close 22 | 23 | objConn.Close 24 | -------------------------------------------------------------------------------- /add sample users.vbs: -------------------------------------------------------------------------------- 1 | ' Add 1000 Sample Users to a Security Group 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objRootDSE = GetObject("LDAP://rootDSE") 7 | Set objContainer = GetObject("LDAP://cn=Users," & _ 8 |     objRootDSE.Get("defaultNamingContext")) 9 | Set objGroup = objContainer.Create("Group", "cn=Group1") 10 | objGroup.Put "sAMAccountName","Group1" 11 | objGroup.SetInfo 12 | 13 | For i = 1 To 1000 14 |     strDN = ",cn=Users," & objRootDSE.defaultNamingContext 15 |     objGroup.PutEx ADS_PROPERTY_APPEND, "member", _ 16 |         Array("cn=UserNo" & i & strDN) 17 |     objGroup.SetInfo 18 | Next 19 | WScript.Echo "Group1 created and 1000 Users added to the group." 20 | -------------------------------------------------------------------------------- /add utf8 byte order mark.vbs: -------------------------------------------------------------------------------- 1 | Set toolkit = CreateObject("Vbsedit.Toolkit") 2 | toolkit.AddBOM "C:\my_utf8_file.txt" 3 | -------------------------------------------------------------------------------- /addition.vbs: -------------------------------------------------------------------------------- 1 | 'Option Explicit 2 | 'Dim firstNumber 3 | 'Assign first number 4 | firstNumber=InputBox("Please enter a number to add:","First number") 5 | firstNumber=Cint(firstNumber) 6 | 'Dim secondNumber 7 | 'Assign second number 8 | secondNumber=Cint(InputBox("Please enter the second number to add"& vbCrLf&"to the sum","Second number",0)) 9 | 'Store sum to the third variable 10 | 'Dim sum 11 | sum=FirstNumber+SecondNumber 12 | 'Display sum 13 | MsgBox "The sum is " & sum 14 | -------------------------------------------------------------------------------- /additional postofficebox information for user account.vbs: -------------------------------------------------------------------------------- 1 | ' Add Additional postOfficeBox Information for a User Account 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objUser = GetObject _ 7 |    ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_APPEND, "postOfficeBox", Array("2225","2226") 10 | objUser.SetInfo 11 | -------------------------------------------------------------------------------- /add UTF-16 byte order mark to a text file.vbs: -------------------------------------------------------------------------------- 1 | Set toolkit = CreateObject("Vbsedit.Toolkit") 2 | 3 | 'For UTF-16 Big Endian - FE FF 4 | toolkit.AddBOM "C:\my_utf8_file.txt",1  5 | 6 | 'For UTF-16 Little Endian - FF FE 7 | toolkit.AddBOM "C:\my_utf8_file.txt",2  8 | -------------------------------------------------------------------------------- /assign group manager.vbs: -------------------------------------------------------------------------------- 1 | ' Assign a Group Manager 2 | 3 | 4 | Set objGroup = GetObject _ 5 |   ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 6 | 7 | objGroup.Put "managedBy", "cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com" 8 | objGroup.SetInfo 9 | -------------------------------------------------------------------------------- /assign new manger ou.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Assign a New Manager to an OU 3 | 4 | 5 | Set objContainer = GetObject _ 6 |   ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 7 | 8 | objContainer.Put "managedBy", "cn=AkersKim,ou=Sales,dc=NA,dc=fabrikam,dc=com" 9 | objContainer.SetInfo 10 | -------------------------------------------------------------------------------- /assign password to user.vbs: -------------------------------------------------------------------------------- 1 | ' Assign a Password to a User 2 | 3 | 4 | Set objUser = GetObject _ 5 |     ("LDAP://cn=MyerKen,ou=management,dc=fabrikam,dc=com") 6 | 7 | objUser.SetPassword "i5A2sj*!" 8 | -------------------------------------------------------------------------------- /assign primary group for user.vbs: -------------------------------------------------------------------------------- 1 | ' Assign the Primary Group for a User 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | Set objGroup = GetObject _ 10 |     ("LDAP://cn=MgmtUniversal,ou=Management,dc=NA,dc=fabrikam,dc=com") 11 | objGroup.GetInfoEx Array("primaryGroupToken"), 0 12 | intPrimaryGroupToken = objGroup.Get("primaryGroupToken") 13 | 14 | objGroup.PutEx ADS_PROPERTY_APPEND, _ 15 |     "member", Array("cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 16 | objGroup.SetInfo 17 | objUser.Put "primaryGroupID", intPrimaryGroupToken 18 | objUser.SetInfo 19 | -------------------------------------------------------------------------------- /auto generate file name.vbs: -------------------------------------------------------------------------------- 1 | ' Auto-Generate a File Name 2 | 3 | 4 | Set objFSO = CreateObject("Scripting.FileSystemObject") 5 | 6 | For i = 1 to 10 7 |     strTempFile = objFSO.GetTempName 8 |     Wscript.Echo strTempFile 9 | Next 10 | -------------------------------------------------------------------------------- /capslock.vbs: -------------------------------------------------------------------------------- 1 | Set wshShell =wscript.CreateObject("WScript.Shell") 2 | wscript.sleep 100 3 | wshshell.sendkeys "{CAPSLOCK}" 4 | -------------------------------------------------------------------------------- /change password.vbs: -------------------------------------------------------------------------------- 1 | ' Change the Password for a User 2 | 3 | 4 | Set objUser = GetObject _ 5 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 6 | 7 | objUser.ChangePassword "i5A2sj*!", "jl3R86df" 8 | -------------------------------------------------------------------------------- /clear com attributes.vbs: -------------------------------------------------------------------------------- 1 | ' Clear COM+ Attributes from a User Account 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_CLEAR, "msCOM-UserPartitionSetLink", 0 10 | objUser.SetInfo 11 | -------------------------------------------------------------------------------- /clear com partition link.vbs: -------------------------------------------------------------------------------- 1 | ' Clear the COM+ Partition Link Set of an OU 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objContainer = GetObject _ 7 |   ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objContainer.PutEx ADS_PROPERTY_CLEAR, "msCOM-UserPartitionSetLink", 0 10 | objContainer.SetInfo 11 | 12 | -------------------------------------------------------------------------------- /clear general properties ou.vbs: -------------------------------------------------------------------------------- 1 | ' Clear the General Properties of an OU 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objContainer = GetObject _ 7 |   ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objContainer.PutEx ADS_PROPERTY_CLEAR, "description", 0 10 | objContainer.PutEx ADS_PROPERTY_CLEAR, "street", 0 11 | objContainer.PutEx ADS_PROPERTY_CLEAR, "l", 0 12 | objContainer.PutEx ADS_PROPERTY_CLEAR, "st", 0 13 | objContainer.PutEx ADS_PROPERTY_CLEAR, "postalCode", 0 14 | objContainer.PutEx ADS_PROPERTY_CLEAR, "c", 0 15 | objContainer.SetInfo 16 | -------------------------------------------------------------------------------- /clear group policy links assigned to ou.vbs: -------------------------------------------------------------------------------- 1 | ' Clear the Group Policy Links Assigned to an OU 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objContainer = GetObject _ 7 |     ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objContainer.PutEx ADS_PROPERTY_CLEAR, "gPLink", 0 10 | objContainer.PutEx ADS_PROPERTY_CLEAR, "gPOptions", 0 11 | objContainer.SetInfo 12 | -------------------------------------------------------------------------------- /clearing user account attributes.vbs: -------------------------------------------------------------------------------- 1 | ' Clearing User Account Address Attributes 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objUser = GetObject _ 7 |    ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_CLEAR, "streetAddress", 0 10 | objUser.PutEx ADS_PROPERTY_CLEAR, "c", 0 11 | objUser.SetInfo 12 | -------------------------------------------------------------------------------- /configure trust relationship.vbs: -------------------------------------------------------------------------------- 1 | ' Configure Trust Relationship Properties 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & _ 7 |         strComputer & "\root\MicrosoftActiveDirectory") 8 | 9 | Set colTrustList = objWMIService.ExecQuery _ 10 |     ("Select * from Microsoft_TrustProvider") 11 | 12 | For Each objTrust in colTrustList 13 |     objTrust.TrustListLifetime = 25 14 |     objTrust.TrustStatusLifetime = 10 15 |     objTrust.TrustCheckLevel = 1 16 |     objTrust.Put_ 17 | Next 18 | -------------------------------------------------------------------------------- /configuring index service to autostart.vbs: -------------------------------------------------------------------------------- 1 | ' Configuring the Indexing Service to Autostart 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | objAdminIS.EnableCI(True) 8 | -------------------------------------------------------------------------------- /connect and query access database.vbs: -------------------------------------------------------------------------------- 1 | 'Connect to and Query a Microsoft Access Database 2 | 3 | Set objConn = CreateObject("ADODB.Connection") 4 | 5 | Set shell = CreateObject( "WScript.Shell" ) 6 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 7 | 8 | objConn.open "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & "mydatabase.accdb" 9 | 10 | Set ors = objConn.Execute("select * from table1") 11 | 12 | Do While Not(ors.EOF) 13 |   WScript.Echo ors("field1").Value 14 |   ors.MoveNext 15 | Loop 16 | 17 | ors.Close 18 | -------------------------------------------------------------------------------- /convert name to adspath.vbs: -------------------------------------------------------------------------------- 1 | ' Convert domain name to ADsPath 2 | 3 | 4 | 5 | strDomainName = "accounting.sea.na.fabrikam.com" 6 | arrDomLevels = Split(strDomainName, ".") 7 | strADsPath = "dc=" & Join(arrDomLevels, ",dc=") 8 | WScript.Echo strADsPath 9 | -------------------------------------------------------------------------------- /copy active directory account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Copy an Active Directory Computer Account 3 | 4 | 5 | Set objCompt = _ 6 |     GetObject("LDAP://cn=Computers,dc=NA,dc=fabrikam,dc=com") 7 | Set objComptCopy = objCompt.Create("computer", "cn=SEA-SQL-01") 8 | objComptCopy.Put "sAMAccountName", "sea-sql-01" 9 | objComptCopy.SetInfo 10 | 11 | Set objComptTemplate = GetObject _ 12 |     ("LDAP://cn=SEA-PM-01,cn=Computers,dc=NA,dc=fabrikam,dc=com") 13 | arrAttributes = Array("description", "location") 14 | 15 | For Each strAttrib in arrAttributes 16 |     strValue = objComptTemplate.Get(strAttrib) 17 |     objComptCopy.Put strAttrib, strValue 18 | Next 19 | 20 | objComptCopy.SetInfo 21 | -------------------------------------------------------------------------------- /copy allow logon hours.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Copy Allowed Logon Hours from One Account to Another 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objUserTemplate = _ 8 |     GetObject("LDAP://cn=userTemplate,OU=Management,dc=NA,dc=fabrikam,dc=com") 9 | arrLogonHours = objUserTemplate.Get("logonHours") 10 | 11 | Set objUser = _ 12 |     GetObject("LDAP://cn=MyerKen,OU=Management,dc=NA,dc=fabrikam,dc=com") 13 | objUser.Put "logonHours", arrLogonHours 14 | objUser.SetInfo 15 | -------------------------------------------------------------------------------- /copy published certificate to user account.vbs: -------------------------------------------------------------------------------- 1 | ' Copy a Published Certificate to a User Account 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const ADS_PROPERTY_UPDATE = 2 7 | 8 | Set objUserTemplate = _ 9 |     GetObject("LDAP://cn=userTemplate,OU=Management,dc=NA,dc=fabrikam,dc=com") 10 | arrUserCertificates = objUserTemplate.GetEx("userCertificate") 11 | 12 | Set objUser = _ 13 |     GetObject("LDAP://cn=MyerKen,OU=Management,dc=NA,dc=fabrikam,dc=com") 14 | objUser.PutEx ADS_PROPERTY_UPDATE, "userCertificate", arrUserCertificates 15 | objUser.SetInfo 16 | -------------------------------------------------------------------------------- /copy published certificate.vbs: -------------------------------------------------------------------------------- 1 | ' Copy a Published Certificate to a User Account 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const ADS_PROPERTY_APPEND = 3 7 | 8 | Set objUserTemplate = _ 9 |     GetObject("LDAP://cn=userTemplate,OU=Management,dc=NA,dc=fabrikam,dc=com") 10 | arrUserCertificates = objUserTemplate.GetEx("userCertificate") 11 | 12 | Set objUser = _ 13 |     GetObject("LDAP://cn=MyerKen,OU=Management,dc=NA,dc=fabrikam,dc=com") 14 | objUser.PutEx ADS_PROPERTY_APPEND, "userCertificate", arrUserCertificates 15 | objUser.SetInfo 16 | -------------------------------------------------------------------------------- /create access database.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Create a new Microsoft Access Database  3 | 4 | connectionString = "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=c:\mynewdatabase.accdb" 5 | 6 | Set catalog = CreateObject("ADOX.Catalog") 7 | 8 | Set objConn = catalog.Create(connectionString) 9 | 10 | objConn.Close()  11 | -------------------------------------------------------------------------------- /create an ou.vbs: -------------------------------------------------------------------------------- 1 | ' Create an OU 2 | 3 | 4 | Set objDomain = GetObject("LDAP://dc=fabrikam,dc=com") 5 | 6 | Set objOU = objDomain.Create("organizationalUnit", "ou=Management") 7 | objOU.SetInfo 8 | -------------------------------------------------------------------------------- /create and name text file.vbs: -------------------------------------------------------------------------------- 1 | ' Create and Auto-Name a Text File 2 | 3 | 4 | Set objFSO = CreateObject("Scripting.FileSystemObject") 5 | 6 | strPath = "C:\FSO" 7 | strFileName = objFSO.GetTempName 8 | strFullName = objFSO.BuildPath(strPath, strFileName) 9 | Set objFile = objFSO.CreateTextFile(strFullName) 10 | objFile.Close 11 | objFSO.DeleteFile(strFullName) 12 | -------------------------------------------------------------------------------- /create contact active directory.vbs: -------------------------------------------------------------------------------- 1 | ' Create a Contact in Active Directory 2 | 3 | 4 | Set objOU = GetObject("LDAP://OU=management,dc=fabrikam,dc=com") 5 | 6 | Set objUser = objOU.Create("contact", "cn=MyerKen") 7 | objUser.SetInfo 8 | -------------------------------------------------------------------------------- /create indexing service catalog.vbs: -------------------------------------------------------------------------------- 1 | ' Create an Indexing Service Catalog 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | objAdminIS.Stop() 8 | 9 | Set objCatalog = objAdminIS.AddCatalog("Script Catalog","c:\scripts") 10 | objAdminIS.Start() 11 | -------------------------------------------------------------------------------- /create indexing service scope.vbs: -------------------------------------------------------------------------------- 1 | ' Create an Indexing Service Scope 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | Set objCatalog = objAdminIS.GetCatalogByName("Script Catalog") 8 | Set objScope = objCatalog.AddScope("c:\scripts\Indexing Server", False) 9 | objScope.Alias = "Script scope" 10 | objScope.Path = "c:\scripts" 11 | -------------------------------------------------------------------------------- /create ou in an ou.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Create an OU in an Existing OU 3 | 4 | 5 | Set objOU1 = GetObject("LDAP://ou=OU1,dc=na,dc=fabrikam,dc=com") 6 | 7 | Set objOU2 = objOU1.Create("organizationalUnit", "ou=OU2") 8 | objOU2.SetInfo 9 | -------------------------------------------------------------------------------- /create text file.vbs: -------------------------------------------------------------------------------- 1 | ' Create a Text File 2 | 3 | 4 | Set objFSO = CreateObject("Scripting.FileSystemObject") 5 | Set objFile = objFSO.CreateTextFile("C:\FSO\ScriptLog.txt") 6 | -------------------------------------------------------------------------------- /create user account and add to group.vbs: -------------------------------------------------------------------------------- 1 | ' Create a User Account and Add it to a Group and an OU 2 | 3 | 4 | Set objDomain = GetObject("LDAP://dc=fabrikam,dc=com") 5 | Set objOU = objDomain.Create("organizationalUnit", "ou=Management") 6 | objOU.SetInfo 7 | 8 | Set objOU = GetObject("LDAP://OU=Management,dc=fabrikam,dc=com") 9 | Set objUser = objOU.Create("User", "cn= AckermanPilar") 10 | objUser.Put "sAMAccountName", "AckermanPila" 11 | objUser.SetInfo 12 | 13 | Set objOU = GetObject("LDAP://OU=Management,dc=fabrikam,dc=com") 14 | Set objGroup = objOU.Create("Group", "cn=atl-users") 15 | objGroup.Put "sAMAccountName", "atl-users" 16 | objGroup.SetInfo 17 | 18 | objGroup.Add objUser.ADSPath 19 | -------------------------------------------------------------------------------- /create user account.vbs: -------------------------------------------------------------------------------- 1 | ' Create a User Account 2 | 3 | 4 | Set objOU = GetObject("LDAP://OU=management,dc=fabrikam,dc=com") 5 | 6 | Set objUser = objOU.Create("User", "cn=MyerKen") 7 | objUser.Put "sAMAccountName", "myerken" 8 | objUser.SetInfo 9 | -------------------------------------------------------------------------------- /delete account.vbs: -------------------------------------------------------------------------------- 1 | ' Delete a Computer Account 2 | 3 | 4 | strComputer = "atl-pro-040" 5 | 6 | set objComputer = GetObject("LDAP://CN=" & strComputer & _ 7 |     ",CN=Computers,DC=fabrikam,DC=com") 8 | objComputer.DeleteObject (0) 9 | -------------------------------------------------------------------------------- /delete active directory subnet.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete an Active Directory Subnet 3 | 4 | 5 | strSubnetCN = "cn=192.168.1.0/26" 6 | 7 | Set objRootDSE = GetObject("LDAP://RootDSE") 8 | strConfigurationNC = objRootDSE.Get("configurationNamingContext") 9 | strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC 10 | 11 | Set objSubnetsContainer = GetObject(strSubnetsContainer) 12 | objSubnetsContainer.Delete "subnet", strSubnetCN 13 | -------------------------------------------------------------------------------- /delete address page information for user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete Address Page Information for a User Account 3 | 4 | 5 | Const ADS_PROPERTY_CLEAR = 1 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 9 | 10 | objUser.PutEx ADS_PROPERTY_CLEAR, "c", 0 11 | objUser.PutEx ADS_PROPERTY_CLEAR, "postOfficeBox", 0 12 | objUser.SetInfo 13 | -------------------------------------------------------------------------------- /delete all contents of text file.vbs: -------------------------------------------------------------------------------- 1 | ' Delete All Contents of a Text File 2 | 3 | 4 | 5 | Const FOR_WRITING = 2 6 | strFileName = "C:\scripts\test.txt" 7 | 8 | Set objFS = CreateObject("Scripting.FileSystemObject") 9 | Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING) 10 | -------------------------------------------------------------------------------- /delete all published certificates from user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Delete All Published Certificates from a User Account 4 | 5 | 6 | Const ADS_PROPERTY_CLEAR = 1 7 | 8 | Set objUser = GetObject _ 9 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 10 | 11 | objUser.PutEx ADS_PROPERTY_CLEAR, "userCertificate", 0 12 | objUser.SetInfo 13 | -------------------------------------------------------------------------------- /delete an ou.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete an OU 3 | 4 | 5 | Set objDomain = GetObject("LDAP://dc=fabrikam,dc=com") 6 | 7 | objDomain.Delete "organizationalUnit", "ou=hr" 8 | -------------------------------------------------------------------------------- /delete calling station id.vbs: -------------------------------------------------------------------------------- 1 | ' Delete a Calling Station ID from a User Account 2 | 3 | 4 | Const ADS_PROPERTY_DELETE = 4 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_DELETE, _ 10 |     "msNPSavedCallingStationID", Array("555-0111") 11 | objUser.PutEx ADS_PROPERTY_DELETE, _ 12 |     "msNPCallingStationID", Array("555-0111") 13 | objUser.SetInfo 14 | -------------------------------------------------------------------------------- /delete first n lines of text file.vbs: -------------------------------------------------------------------------------- 1 | ' Delete First n Lines of a Text File 2 | 3 | 4 | 5 | Const FOR_READING = 1 6 | Const FOR_WRITING = 2 7 | strFileName = "C:\scripts\test.txt" 8 | iNumberOfLinesToDelete = 5 9 | 10 | Set objFS = CreateObject("Scripting.FileSystemObject") 11 | Set objTS = objFS.OpenTextFile(strFileName, FOR_READING) 12 | strContents = objTS.ReadAll 13 | objTS.Close 14 | 15 | arrLines = Split(strContents, vbNewLine) 16 | Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING) 17 | 18 | For i=0 To UBound(arrLines) 19 |    If i > (iNumberOfLinesToDelete - 1) Then 20 |       objTS.WriteLine arrLines(i) 21 |    End If 22 | Next 23 | -------------------------------------------------------------------------------- /delete group.vbs: -------------------------------------------------------------------------------- 1 | ' Delete a Group from Active Directory 2 | 3 | 4 | Set objOU = GetObject("LDAP://ou=hr,dc=fabrikam,dc=com") 5 | 6 | objOU.Delete "group", "cn=atl-users" 7 | -------------------------------------------------------------------------------- /delete indexing service catalog.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete an Indexing Service Catalog 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 8 | objAdminIS.Stop() 9 | errResult = objAdminIS.RemoveCatalog("Script Catalog", True) 10 | objAdminIS.Start() 11 | -------------------------------------------------------------------------------- /delete indexing service scope.vbs: -------------------------------------------------------------------------------- 1 | ' Delete an Indexing Service Scope 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | Set objCatalog = objAdminIS.GetCatalogByName("Script Catalog") 8 | objCatalog.RemoveScope("c:\scripts") 9 | -------------------------------------------------------------------------------- /delete last n lines of a text file.vbs: -------------------------------------------------------------------------------- 1 | ' Delete Last n Lines of a Text File 2 | 3 | 4 | 5 | Const FOR_READING = 1 6 | Const FOR_WRITING = 2 7 | strFileName = "C:\scripts\test.txt" 8 | iNumberOfLinesToDelete = 5 9 | 10 | Set objFS = CreateObject("Scripting.FileSystemObject") 11 | Set objTS = objFS.OpenTextFile(strFileName, FOR_READING) 12 | strContents = objTS.ReadAll 13 | objTS.Close 14 | 15 | arrLines = Split(strContents, vbNewLine) 16 | Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING) 17 | iIndexToDeleteFrom = UBound(arrLines)- iNumberOfLinesToDelete + 1 18 | 19 | For i=0 To UBound(arrLines) 20 |    If i < iIndexToDeleteFrom Then 21 |       objTS.WriteLine arrLines(i) 22 |    End If 23 | Next 24 | -------------------------------------------------------------------------------- /delete line range.vbs: -------------------------------------------------------------------------------- 1 | ' Delete Line Range within a Text File 2 | 3 | 4 | 5 | Const FOR_READING = 1 6 | Const FOR_WRITING = 2 7 | strFileName = "C:\scripts\test.txt" 8 | iStartAtLineNumber = 3 9 | iEndAtLineNumber   = 7 10 | 11 | Set objFS = CreateObject("Scripting.FileSystemObject") 12 | Set objTS = objFS.OpenTextFile(strFileName, FOR_READING) 13 | strContents = objTS.ReadAll 14 | objTS.Close 15 | 16 | arrLines = Split(strContents, vbNewLine) 17 | Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING) 18 | 19 | For i=0 To UBound(arrLines) 20 |    If i < (iStartAtLineNumber-1) OR i > (iEndAtLineNumber-1) Then 21 |       objTS.WriteLine arrLines(i) 22 |    End If 23 | Next 24 | -------------------------------------------------------------------------------- /delete n-th line of text file.vbs: -------------------------------------------------------------------------------- 1 | ' Delete n-th Line of a Text File 2 | 3 | 4 | 5 | Const FOR_READING = 1 6 | Const FOR_WRITING = 2 7 | strFileName = "C:\scripts\test.txt" 8 | iLineNumber = 3 9 | 10 | Set objFS = CreateObject("Scripting.FileSystemObject") 11 | Set objTS = objFS.OpenTextFile(strFileName, FOR_READING) 12 | strContents = objTS.ReadAll 13 | objTS.Close 14 | 15 | Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING) 16 | 17 | arrLines = Split(strContents,vbNewLine) 18 | For i=0 To UBound(arrLines) 19 |    If i<> (iLineNumber-1) Then 20 |       objTS.WriteLine arrLines(i) 21 |    End If 22 | Next 23 | -------------------------------------------------------------------------------- /delete othermobile phone number.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete an otherMobile Phone Number 3 | 4 | 5 | Const ADS_PROPERTY_DELETE = 4 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 9 | 10 | objUser.PutEx ADS_PROPERTY_DELETE, _ 11 |     "otherMobile", Array("(425) 555-3334") 12 | objUser.SetInfo 13 | -------------------------------------------------------------------------------- /delete post office box from user account.vbs: -------------------------------------------------------------------------------- 1 | ' Delete a Post Office Box from a User Account 2 | 3 | 4 | Const ADS_PROPERTY_DELETE = 4 5 | 6 | Set objUser = GetObject _ 7 |    ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_DELETE, "postOfficeBox", Array("2224") 10 | objUser.SetInfo 11 | -------------------------------------------------------------------------------- /delete published certificates from user account.vbs: -------------------------------------------------------------------------------- 1 | ' Delete Published Certificates from a User Account 2 | 3 | 4 | On Error Resume Next 5 | 6 | Const ADS_PROPERTY_DELETE = 4 7 | 8 | Set objUserTemplate = _ 9 |     GetObject("LDAP://cn=userTemplate,OU=Management,dc=NA,dc=fabrikam,dc=com") 10 | arrUserCertificates = objUserTemplate.GetEx("userCertificate") 11 | 12 | Set objUser = _ 13 |     GetObject("LDAP://cn=MyerKen,OU=Management,dc=NA,dc=fabrikam,dc=com") 14 | 15 | objUser.PutEx ADS_PROPERTY_DELETE, "userCertificate", arrUserCertificates 16 | objUser.SetInfo 17 | -------------------------------------------------------------------------------- /delete selected attributes from user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete Selected Attributes from a User Account 3 | 4 | 5 | Const ADS_PROPERTY_DELETE = 4 6 | 7 | Set objUser = GetObject _ 8 |    ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 9 | 10 | objUser.PutEx ADS_PROPERTY_DELETE, _ 11 |    "otherTelephone", Array("(425) 555-1213") 12 | objUser.PutEx ADS_PROPERTY_DELETE, "initials", Array("E.") 13 | objUser.SetInfo 14 | -------------------------------------------------------------------------------- /delete selected user account attributes.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Delete Selected User Account Attributes 3 | 4 | 5 | Const ADS_PROPERTY_CLEAR = 1 6 | 7 | Set objUser = GetObject _ 8 |    ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 9 | 10 | objUser.PutEx ADS_PROPERTY_CLEAR, "initials", 0 11 | objUser.PutEx ADS_PROPERTY_CLEAR, "otherTelephone", 0 12 | objUser.SetInfo 13 | -------------------------------------------------------------------------------- /delete software.vbs: -------------------------------------------------------------------------------- 1 | ' Delete Software 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colSoftware = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_Product Where Name = 'Personnel database'") 10 | 11 | For Each objSoftware in colSoftware 12 |     objSoftware.Uninstall() 13 | Next 14 | -------------------------------------------------------------------------------- /delete user account telephone attributes.vbs: -------------------------------------------------------------------------------- 1 | ' Delete User Account Telephone Attributes 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objUser = GetObject _ 7 |    ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_CLEAR, "info", 0 10 | objUser.PutEx ADS_PROPERTY_CLEAR, "otherPager", 0 11 | objUser.SetInfo 12 | -------------------------------------------------------------------------------- /delete user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Delete a User Account from Active Directory 4 | 5 | 6 | Set objOU = GetObject("LDAP://ou=hr,dc=fabrikam,dc=com") 7 | 8 | objOU.Delete "user", "cn=MyerKen" 9 | -------------------------------------------------------------------------------- /deleting files in directory.vbs: -------------------------------------------------------------------------------- 1 | ' Deleting Files in a Directory with Names That Match a Regular Expression 2 | 3 | 4 | 5 | strFolderName = "C:\scripts\textfiles\delete\" 6 | strREPattern = "log\d\d_\d\d05\.txt" 7 | 8 | Set objFS = CreateObject("Scripting.FileSystemObject") 9 | 10 | Set objFolder = objFS.GetFolder(strFolderName) 11 | Set objRE = new RegExp 12 | objRE.Pattern    = strREPattern 13 | objRE.IgnoreCase = True 14 | 15 | For Each objFile In objFolder.Files 16 |    If objRE.Test(objFile.Name) Then 17 |       objFS.DeleteFile(strFolderName & objFile.Name) 18 |    End If 19 | Next 20 | -------------------------------------------------------------------------------- /disable global catalog server.vbs: -------------------------------------------------------------------------------- 1 | ' Disable a Global Catalog Server 2 | 3 | 4 | strComputer = "atl-dc-01" 5 | 6 | Const NTDSDSA_OPT_IS_GC = 1 7 | 8 | Set objRootDSE = GetObject("LDAP://" & strComputer & "/rootDSE") 9 | strDsServiceDN = objRootDSE.Get("dsServiceName") 10 | Set objDsRoot  = GetObject _ 11 |     ("LDAP://" & strComputer & "/" & strDsServiceDN) 12 | intOptions = objDsRoot.Get("options") 13 | 14 | If intOptions And NTDSDSA_OPT_IS_GC Then 15 |     objDsRoot.Put "options", intOptions Xor NTDSDSA_OPT_IS_GC 16 |     objDsRoot.Setinfo 17 | End If 18 | -------------------------------------------------------------------------------- /disable smartcard attribute for user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Disable the Smartcard Required Attribute for a User Account 3 | 4 | 5 | Const ADS_UF_SMARTCARD_REQUIRED = &h40000 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 9 | 10 | intUAC = objUser.Get("userAccountControl") 11 | 12 | If (intUAC AND ADS_UF_SMARTCARD_REQUIRED) <> 0 Then 13 |     objUser.Put "userAccountControl", intUAC XOR ADS_UF_SMARTCARD_REQUIRED 14 |     objUser.SetInfo 15 | End If 16 | -------------------------------------------------------------------------------- /disable user account.vbs: -------------------------------------------------------------------------------- 1 | ' Disable a User Account 2 | 3 | 4 | Const ADS_UF_ACCOUNTDISABLE = 2 5 | 6 | Set objUser = GetObject _ 7 | ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 8 | intUAC = objUser.Get("userAccountControl") 9 | 10 | objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE 11 | objUser.SetInfo 12 | -------------------------------------------------------------------------------- /domain information.vbs: -------------------------------------------------------------------------------- 1 | ' List Domain Information for Trust Partners 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & _ 7 |         strComputer & "\root\MicrosoftActiveDirectory") 8 | 9 | Set colDomainInfo = objWMIService.ExecQuery _ 10 |     ("Select * from Microsoft_LocalDomainInfo") 11 | 12 | For each objDomain in colDomainInfo 13 |     Wscript.Echo "DNS name: " & objDomain.DNSName 14 |     Wscript.Echo "Flat name: " & objDomain.FlatName 15 |     Wscript.Echo "SID: " & objDomain.SID 16 |     Wscript.Echo "Tree name: " & objDomain.TreeName 17 |     Wscript.Echo "Domain controller name: " & objDomain.DCName 18 | Next 19 | -------------------------------------------------------------------------------- /domain local distribution group.vbs: -------------------------------------------------------------------------------- 1 | ' Create a Domain Local Distribution Group 2 | 3 | 4 | Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4 5 | 6 | Set objOU = GetObject("LDAP://ou=HR,dc=NA,dc=fabrikam,dc=com") 7 | Set objGroup = objOU.Create("Group", "cn=Vendors") 8 | 9 | objGroup.Put "sAMAccountName", "vendors" 10 | objGroup.Put "groupType", ADS_GROUP_TYPE_LOCAL_GROUP 11 | objGroup.SetInfo 12 | -------------------------------------------------------------------------------- /enable global catalog server.vbs: -------------------------------------------------------------------------------- 1 | ' Enable a Global Catalog Server 2 | 3 | 4 | strComputer = "atl-dc-01" 5 | 6 | Const NTDSDSA_OPT_IS_GC = 1 7 | 8 | Set objRootDSE = GetObject("LDAP://" & strComputer & "/RootDSE") 9 | strDsServiceDN = objRootDSE.Get("dsServiceName") 10 | Set objDsRoot  = GetObject _ 11 |     ("LDAP://" & strComputer & "/" & strDsServiceDN) 12 | intOptions = objDsRoot.Get("options") 13 | 14 | If (intOptions And NTDSDSA_OPT_IS_GC) = FALSE Then 15 |     objDsRoot.Put "options" , intOptions Or NTDSDSA_OPT_IS_GC 16 |     objDsRoot.Setinfo 17 | End If 18 | -------------------------------------------------------------------------------- /enable user account.vbs: -------------------------------------------------------------------------------- 1 | ' Enable a User Account 2 | 3 | 4 | Set objUser = GetObject _ 5 |   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 6 | 7 | objUser.AccountDisabled = FALSE 8 | objUser.SetInfo 9 | -------------------------------------------------------------------------------- /enable user logon.vbs: -------------------------------------------------------------------------------- 1 | ' Enable a User to Log on at Any Time 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objUser = GetObject _ 7 |   ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.PutEx ADS_PROPERTY_CLEAR, "logonHours", 0 10 | objUser.SetInfo 11 | -------------------------------------------------------------------------------- /enumerate installed odbc drivers.vbs: -------------------------------------------------------------------------------- 1 | 2 | 'Enumerate installed ODBC Drivers on local computer 3 | 4 | Const HKEY_LOCAL_MACHINE = &H80000002 5 | 6 | Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv") 7 | strKeyPath = "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" 8 | objRegistry.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes 9 | For i = 0 to UBound(arrValueNames) 10 |     strValueName = arrValueNames(i) 11 |     objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue     12 |     Wscript.Echo arrValueNames(i) & " — " & strValue 13 | Next 14 | -------------------------------------------------------------------------------- /enumerate installed ole db.vbs: -------------------------------------------------------------------------------- 1 | 2 | 'Enumerate installed OLE DB providers on local computer 3 | 4 | Const HKEY_CLASSES_ROOT = &H80000000 5 | 6 | Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv") 7 | 8 | objRegistry.enumKey HKEY_CLASSES_ROOT, "CLSID", arrKeys 9 | 10 | For each key in arrKeys 11 |   If objRegistry.GetDWordValue (HKEY_CLASSES_ROOT,"CLSID\" & key,"OLEDB_SERVICES",uValue)=0 Then 12 |     objRegistry.GetStringValue HKEY_CLASSES_ROOT,"CLSID\" & key,"",providerName 13 |     objRegistry.GetStringValue HKEY_CLASSES_ROOT,"CLSID\" & key & "\OLE DB Provider","",description 14 |     WScript.Echo "[" & providerName & "] " & description 15 |   End if 16 | Next 17 | -------------------------------------------------------------------------------- /extract data from microsoft excel.vbs: -------------------------------------------------------------------------------- 1 | ' Extract Data from Microsoft Excel 2 | 3 | Set objConn = CreateObject("ADODB.Connection") 4 | 5 | Set shell = CreateObject( "WScript.Shell" ) 6 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 7 | 8 | objConn.open "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & "data.xlsx; Extended Properties=""Excel 12.0;"";" 9 | 10 | Set ors = objConn.Execute("select * from [data$]") 11 | 12 | Do While Not(ors.EOF) 13 |   WScript.Echo ors("col1").Value & " " & ors("col2").Value 14 |   ors.MoveNext 15 | Loop 16 | 17 | ors.Close 18 | -------------------------------------------------------------------------------- /fakemalware.vbs: -------------------------------------------------------------------------------- 1 | x=msgbox("Do Not Open! Risk of Malware.", 2+48, "Windows Antivirus: WARNING") 2 | if x=3 then 3 | end if 4 | if x=4 then 5 | x=msgbox("Do Not Open! Risk of Malware.", 2+48, "Windows Antivirus: WARNING") 6 | end if 7 | if x=5 then 8 | x=msgbox("Malware Activated", 0+48, "Windows Antivirus: Malware Activated") 9 | end if 10 | -------------------------------------------------------------------------------- /fax server activity logging options.vbs: -------------------------------------------------------------------------------- 1 | ' List Fax Server Activity Logging Options 2 | 3 | 4 | Set objFaxServer = CreateObject("FaxComEx.FaxServer") 5 | objFaxServer.Connect "atl-dc-02" 6 | 7 | Set objFaxLoggingOptions = objFaxServer.LoggingOptions 8 | Set objFaxActivityLogging = objFaxLoggingOptions.ActivityLogging 9 | Wscript.Echo "Database path: " & _ 10 |     objFaxActivityLogging.DatabasePath 11 | Wscript.Echo "Log incoming: " & _ 12 |     objFaxActivityLogging.LogIncoming 13 | Wscript.Echo "Log outgoing: " & _ 14 |     objFaxActivityLogging.LogOutgoing 15 | -------------------------------------------------------------------------------- /fax server event logging options.vbs: -------------------------------------------------------------------------------- 1 | ' List Fax Server Event Logging Options 2 | 3 | 4 | Set objFaxServer = CreateObject("FaxComEx.FaxServer") 5 | objFaxServer.Connect "atl-dc-02" 6 | 7 | Set objFaxLoggingOptions = objFaxServer.LoggingOptions 8 | 9 | Set objFaxEventLogging = objFaxLoggingOptions.EventLogging 10 | Wscript.Echo "General events level: " & _ 11 |     objFaxEventLogging.GeneralEventsLevel 12 | Wscript.Echo "Inbound events level: " & _ 13 |     objFaxEventLogging.InboundEventsLevel 14 | Wscript.Echo "Initialization events level: " & _ 15 |     objFaxEventLogging.InitEventsLevel 16 | Wscript.Echo "Outbound events level: " & _ 17 |     objFaxEventLogging.OutboundEventsLevel 18 | -------------------------------------------------------------------------------- /fax server incoming queue information.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ' List Fax Server Incoming Queue Information 5 | 6 | 7 | Set objFaxServer = CreateObject("FaxComEx.FaxServer") 8 | objFaxServer.Connect "atl-dc-02" 9 | 10 | Set objFolder = objFaxServer.Folders 11 | 12 | Set objIncomingQueue = objFolder.IncomingQueue 13 | Wscript.Echo "Blocked: " & objIncomingQueue.Blocked 14 | -------------------------------------------------------------------------------- /fax server information.vbs: -------------------------------------------------------------------------------- 1 | ' List Fax Server Information 2 | 3 | 4 | Set objFaxServer = CreateObject("FaxComEx.FaxServer") 5 | objFaxServer.Connect "atl-dc-02" 6 | 7 | Wscript.Echo "API version: " & objFaxServer.APIVersion 8 | Wscript.Echo "Major build: " & objFaxServer.MajorBuild 9 | Wscript.Echo "Minor build: " & objFaxServer.MinorBuild 10 | Wscript.Echo "Major version: " & objFaxServer.MajorVersion 11 | Wscript.Echo "Minor version: " & objFaxServer.MinorVersion 12 | Wscript.Echo "Server name: " & objFaxServer.ServerName 13 | -------------------------------------------------------------------------------- /fax server security information.vbs: -------------------------------------------------------------------------------- 1 | ' List Fax Server Security Information 2 | 3 | 4 | Set objFaxServer = CreateObject("FaxComEx.FaxServer") 5 | objFaxServer.Connect "atl-dc-02" 6 | 7 | Set objSecurity = objFaxServer.Security 8 | 9 | Wscript.Echo "Security descriptor: " & objSecurity.Descriptor 10 | Wscript.Echo "Granted rights: " & objSecurity.GrantedRights 11 | Wscript.Echo "Information type: " & objSecurity.InformationType 12 | -------------------------------------------------------------------------------- /frs replication.vbs: -------------------------------------------------------------------------------- 1 | ' Monitor FRS Replication 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colFRSSet = objWMIService.ExecQuery _   9 | ("Select * from Win32_PerfFormattedData_FileReplicaConn_FileReplicaConn") 10 | 11 | For Each objFRSInstance in colFRSSet 12 |     Wscript.Echo "Remote change orders received: " & _ 13 |         objFRSInstance.RemoteChangeOrdersReceived 14 |     Wscript.Echo "Remote change orders sent: " & _ 15 |         objFRSInstance.RemoteChangeOrdersSent 16 |     Wscript.Echo "Packets sent: " & objFRSInstance.PacketsSent 17 | Next 18 | -------------------------------------------------------------------------------- /general properties of ou.vbs: -------------------------------------------------------------------------------- 1 | ' List the General Properties of an OU 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objContainer = GetObject _ 7 |   ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | For Each strValue in objContainer.description 10 |   WScript.Echo "Description: " & strValue 11 | Next 12 | 13 | Wscript.Echo "Street Address: " & strStreetAddress 14 | Wscript.Echo "Locality: " & 15 | Wscript.Echo "State/porvince: " & objContainer.st 16 | Wscript.Echo "Postal Code: " & objContainer.postalCode 17 | Wscript.Echo "Country: " & objContainer.c 18 | 19 | -------------------------------------------------------------------------------- /global distribution group.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Create a Global Distribution Group 3 | 4 | 5 | Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2 6 | 7 | Set objOU = GetObject("LDAP://ou=R&D,dc=NA,dc=fabrikam,dc=com") 8 | Set objGroup = objOU.Create("Group", "cn=Scientists") 9 | 10 | objGroup.Put "sAMAccountName", "scientists" 11 | objGroup.Put "groupType", ADS_GROUP_TYPE_GLOBAL_GROUP 12 | objGroup.SetInfo 13 | -------------------------------------------------------------------------------- /gps coordinates.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' GPS Coordinates (Latitude, Longitude) from Address 3 | 4 | address="11 rue de Turbigo Paris" 5 | 6 | Set o = CreateObject("MSXML2.XMLHTTP") 7 | o.open "GET", "https://maps.googleapis.com/maps/api/geocode/xml?address=" & address, False 8 | o.send 9 | 10 | Set objDoc = CreateObject("MSXML2.DOMDocument") 11 | objDoc.loadXML o.responseText 12 | 13 | WScript.Echo objDoc.selectSingleNode("GeocodeResponse/status").text 14 | Set latlong = objDoc.selectSingleNode("GeocodeResponse/result/geometry/location") 15 | WScript.Echo latlong.selectSingleNode("lat").text 16 | WScript.Echo latlong.selectSingleNode("lng").text 17 | -------------------------------------------------------------------------------- /information about binary files used by application.vbs: -------------------------------------------------------------------------------- 1 | ' List Information About the Binary Files Used by an Application 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery("Select * from Win32_Binary") 11 | 12 | For Each objItem in colItems 13 |     Wscript.Echo "Name: " & objItem.Name 14 |     Wscript.Echo "Product Code: " & objItem.ProductCode 15 |     Wscript.Echo 16 | Next 17 | -------------------------------------------------------------------------------- /install software on local machine.vbs: -------------------------------------------------------------------------------- 1 | ' Install Software on the Local Computer 2 | 3 | 4 | Const ALL_USERS = True 5 | 6 | Set objService = GetObject("winmgmts:") 7 | Set objSoftware = objService.Get("Win32_Product") 8 | errReturn = objSoftware.Install("c:\scripts\database.msi", , ALL_USERS) 9 | -------------------------------------------------------------------------------- /install software on remote machine: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Install Software on a Remote Computer 4 | 5 | 6 | Const wbemImpersonationLevelDelegate = 4 7 | 8 | Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") 9 | Set objConnection = objwbemLocator.ConnectServer _ 10 |     ("WebServer", "root\cimv2", "fabrikam\administrator", _ 11 |          "password", , "kerberos:WebServer") 12 | objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate 13 | 14 | Set objSoftware = objConnection.Get("Win32_Product") 15 | errReturn = objSoftware.Install("\\atl-dc-02\scripts\1561_lab.msi",,True) 16 | -------------------------------------------------------------------------------- /internet explorer.vbs: -------------------------------------------------------------------------------- 1 | dim sURL 2 | sURL= "https://www.github.com/Eggy115" 3 | dim objIE 4 | Set objIE = CreateObject("InternetExplorer.Application") 5 | objIE.visible = True 6 | objIE.navigate(surl) 7 | -------------------------------------------------------------------------------- /list account page information.vbs: -------------------------------------------------------------------------------- 1 | ' List Account Page Information for a User Account 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=Myerken,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | WScript.Echo "User Principal Name: " & objUser.userPrincipalName 10 | WScript.Echo "SAM Account Name: " & objUser.sAMAccountName 11 | WScript.Echo "User Workstations: " & objUser.userWorkstations 12 | 13 | Set objDomain = GetObject("LDAP://dc=NA,dc=fabrikam,dc=com") 14 | WScript.Echo "Domain controller: " & objDomain.dc 15 | -------------------------------------------------------------------------------- /list active directory sites.vbs: -------------------------------------------------------------------------------- 1 | ' List Active Directory Sites 2 | 3 | 4 | Set objRootDSE = GetObject("LDAP://RootDSE") 5 | strConfigurationNC = objRootDSE.Get("configurationNamingContext") 6 | 7 | strSitesContainer = "LDAP://cn=Sites," & strConfigurationNC 8 | Set objSitesContainer = GetObject(strSitesContainer) 9 | objSitesContainer.Filter = Array("site") 10 | 11 | For Each objSite In objSitesContainer 12 |     WScript.Echo "Name: " & objSite.Name 13 | Next 14 | -------------------------------------------------------------------------------- /list address page information for user account.vbs: -------------------------------------------------------------------------------- 1 | ' List Address Page Information for a User Account 2 | 3 | 4 | On Error Resume Next 5 | Set objUser = GetObject _ 6 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 7 | 8 | WScript.Echo "Street Address: " & objUser.streetAddress 9 | WScript.Echo "Locality: " & objUser.l 10 | WScript.Echo "State/province: " & objUser.st 11 | WScript.Echo "Postal Code: " & objUser.postalCode 12 | WScript.Echo "Country: " & objUser.c 13 | 14 | WScript.Echo "Post Office Boxes:" 15 | For Each strValue in objUser.postOfficeBox 16 |     WScript.echo vbTab & vbTab & strValue 17 | Next 18 | -------------------------------------------------------------------------------- /list com+ information.vbs: -------------------------------------------------------------------------------- 1 | ' List COM+ Information for a User Account 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | WScript.Echo "COM User Partition Set Link: " & _ 10 |     objUser.msCOM-UserPartitionSetLink 11 | -------------------------------------------------------------------------------- /list com+ partition sets.vbs: -------------------------------------------------------------------------------- 1 | ' List COM+ Partition Sets 2 | 3 | 4 | Set objCOMPartitionSets = GetObject _ 5 |     ("LDAP://cn=ComPartitionSets,cn=System,dc=NA,dc=fabrikam,dc=com") 6 | 7 | For Each objPartitionSet in objCOMPartitionSets 8 |     WScript.Echo "Name: " & objPartitionSet.Name 9 | Next 10 | -------------------------------------------------------------------------------- /list com+ partitions.vbs: -------------------------------------------------------------------------------- 1 | ' List COM+ Partition Information for a Domain 2 | 3 | 4 | Set objCOMPartitionSets = GetObject _ 5 |     ("LDAP://cn=ComPartitionSets,cn=System,dc=NA,dc=fabrikam,dc=com") 6 | 7 | For Each objPartitionSet in objCOMPartitionSets 8 |     WScript.Echo "Name: " & objPartitionSet.Name 9 | Next 10 | -------------------------------------------------------------------------------- /list com+ properties of OU: -------------------------------------------------------------------------------- 1 | ' List the COM+ Properties of an OU 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objContainer = GetObject _ 7 |     ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | strMsCOMUserPartitionSetLink = objContainer.Get("msCOM-UserPartitionSetLink") 10 | WScript.Echo "ms-COMUserPartitionSetLink: " & strMsCOMUserPartitionSetLink 11 | 12 | -------------------------------------------------------------------------------- /list domain controller.vbs: -------------------------------------------------------------------------------- 1 | ' List Your Domain Controller 2 | 3 | 4 | Set objDomain = GetObject("LDAP://rootDse") 5 | 6 | objDC = objDomain.Get("dnsHostName") 7 | Wscript.Echo "Authenticating domain controller:" & objDC 8 | -------------------------------------------------------------------------------- /list installed or advertised components and applications.vbs: -------------------------------------------------------------------------------- 1 | ' List Installed or Advertised Components and Applications 2 | 3 | 4 | On Error Resume Next 5 | 6 | strComputer = "." 7 | Set objWMIService = GetObject("winmgmts:" _ 8 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 9 | 10 | Set colItems = objWMIService.ExecQuery _ 11 |     ("Select * from Win32_ApplicationService") 12 | 13 | For Each objItem in colItems 14 |     Wscript.Echo "Name: " & objItem.Name 15 |     Wscript.Echo "Start Mode: " & objItem.StartMode 16 |     Wscript.Echo 17 | Next 18 | -------------------------------------------------------------------------------- /list microsoft product ids.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Microsoft Product IDs 3 | 4 | 5 | Set objMSInfo = CreateObject("MsPIDinfo.MsPID") 6 | colMSApps = objMSInfo.GetPIDInfo() 7 | 8 | For Each strApp in colMSApps 9 |     Wscript.Echo strApp 10 | Next 11 | -------------------------------------------------------------------------------- /list organisation information for user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Organization Information for a User Account 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 9 | 10 | WScript.Echo "Title: " & objUser.title 11 | WScript.Echo "Department: " & objUser.department 12 | WScript.Echo "Company: " & objUser.company 13 | WScript.Echo "Manager: " & objUser.manager 14 | 15 | For Each strValue in objUser.directReports 16 |     WScript.Echo "Direct Reports: " & strValue 17 | Next 18 | -------------------------------------------------------------------------------- /list owner of ou.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List the Owner of an OU 3 | 4 | 5 | Set objContainer = GetObject _ 6 |   ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 7 | 8 | Set objNtSecurityDescriptor = objContainer.Get("ntSecurityDescriptor") 9 | 10 | WScript.Echo "Owner Tab" 11 | WScript.Echo "Current owner of this item: " & objNtSecurityDescriptor.Owner 12 | -------------------------------------------------------------------------------- /list owner of user account.vbs: -------------------------------------------------------------------------------- 1 | ' List the Owner of a User Account 2 | 3 | 4 | Set objUser = GetObject _ 5 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 6 | 7 | Set objNtSecurityDescriptor = objUser.Get("ntSecurityDescriptor") 8 | WScript.Echo "Owner Tab" 9 | WScript.Echo "Current owner of this item: " & objNtSecurityDescriptor.Owner 10 | -------------------------------------------------------------------------------- /list protocols bridgehead server replicates.vbs: -------------------------------------------------------------------------------- 1 | ' List the Protocols Over Which a Bridgehead Server Replicates 2 | 3 | 4 | On Error Resume Next 5 |    6 | Set objServer = GetObject _ 7 |     ("LDAP://CN=SEA-DC-01,CN=Servers,CN=Default-First-Site-Name,"  & _ 8 |         " CN=Sites,CN=Configuration,DC=fabrikam,DC=com") 9 | 10 | dnBHTList = objServer.GetEx("bridgeheadTransportList") 11 | 12 | WScript.Echo "Bridge Head Transport List:" 13 | WScript.Echo "This multi-valued attribute lists the protocol" & _ 14 |     "transports over which this BridgeHead Server replicates" 15 | For Each dnValue in dnBHTList 16 |     WScript.Echo "Value: " & dnValue 17 | Next 18 | -------------------------------------------------------------------------------- /list protocols bridgehead server.vbs: -------------------------------------------------------------------------------- 1 | ' List the Protocols Over Which a Bridgehead Server Replicates 2 | 3 | 4 | On Error Resume Next 5 |    6 | Set objServer = GetObject _ 7 |     ("LDAP://CN=SEA-DC-01,CN=Servers,CN=Default-First-Site-Name,"  & _ 8 |         " CN=Sites,CN=Configuration,DC=fabrikam,DC=com") 9 | 10 | dnBHTList = objServer.GetEx("bridgeheadTransportList") 11 | 12 | WScript.Echo "Bridge Head Transport List:" 13 | WScript.Echo "This multi-valued attribute lists the protocol" & _ 14 |     "transports over which this BridgeHead Server replicates" 15 | For Each dnValue in dnBHTList 16 |     WScript.Echo "Value: " & dnValue 17 | Next 18 | -------------------------------------------------------------------------------- /list selected attributes.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List Selected Computer Account Attributes 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objComputer = GetObject _ 8 |     ("LDAP://CN=atl-dc-01,CN=Computers,DC=fabrikam,DC=com") 9 | 10 | objProperty = objComputer.Get("Location") 11 | If IsNull(objProperty) Then 12 |     Wscript.Echo "The location has not been set." 13 | Else 14 |     Wscript.Echo "Location: " & objProperty 15 |     objProperty = Null 16 | End If 17 | 18 | objProperty = objComputer.Get("Description") 19 | If IsNull(objProperty) Then 20 |     Wscript.Echo "The description has not been set." 21 | Else 22 |     Wscript.Echo "Description: " & objProperty 23 |     objProperty = Null 24 | End If 25 | -------------------------------------------------------------------------------- /list servers in active directory site.vbs: -------------------------------------------------------------------------------- 1 | ' List Servers in an Active Directory Site 2 | 3 | 4 | strSiteRDN = "cn=Ga-Atl-Sales" 5 | 6 | Set objRootDSE = GetObject("LDAP://RootDSE") 7 | strConfigurationNC = objRootDSE.Get("configurationNamingContext") 8 | 9 | strServersPath = "LDAP://cn=Servers," & strSiteRDN & ",cn=Sites," & _ 10 |     strConfigurationNC 11 | Set objServersContainer = GetObject(strServersPath) 12 | 13 | For Each objServer In objServersContainer 14 |     WScript.Echo "Name: " & objServer.Name 15 | Next 16 | -------------------------------------------------------------------------------- /list site name for domain controller.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List the Site Name for a  Domain Controller 3 | 4 | 5 | strDcName = "atl-dc-01" 6 | Set objADSysInfo = CreateObject("ADSystemInfo") 7 | 8 | strDcSiteName = objADSysInfo.GetDCSiteName(strDcName) 9 | WScript.Echo "DC Site Name: " & strDcSiteName 10 | -------------------------------------------------------------------------------- /list state of indexing service.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List the State of the Indexing Service 4 | 5 | 6 | On Error Resume Next 7 | 8 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 9 | Wscript.Echo "Is running: " & objAdminIS.IsRunning 10 | Wscript.Echo "Is paused: " & objAdminIS.IsPaused 11 | Wscript.Echo "Computer name: " & objAdminIS.MachineName 12 | -------------------------------------------------------------------------------- /list system locations.vbs: -------------------------------------------------------------------------------- 1 | ' List System Locations 2 | 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 7 | Set colOSItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem") 8 | For Each objOSItem In colOSItems 9 |   WScript.Echo "Boot Device: " & objOSItem.BootDevice 10 |   WScript.Echo "System Device: " & objOSItem.SystemDevice 11 |   WScript.Echo "System Drive: " & objOSItem.SystemDrive 12 |   WScript.Echo "Windows Directory: " & objOSItem.WindowsDirectory 13 |   WScript.Echo "System Directory: " & objOSItem.SystemDirectory 14 | Next 15 | -------------------------------------------------------------------------------- /members of groups.vbs: -------------------------------------------------------------------------------- 1 | ' List All the Members of a Group 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objGroup = GetObject _ 7 |   ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 8 | objGroup.GetInfo 9 | 10 | arrMemberOf = objGroup.GetEx("member") 11 | 12 | WScript.Echo "Members:" 13 | For Each strMember in arrMemberOf 14 |     WScript.echo strMember 15 | Next 16 | -------------------------------------------------------------------------------- /modify COM+ partition set link.vbs: -------------------------------------------------------------------------------- 1 | ' Modify the COM+ Partition Set Link of an OU 2 | 3 | 4 | Set objContainer = GetObject _ 5 |     ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 6 | 7 | objContainer.Put "msCOM-UserPartitionSetLink", _ 8 |     "cn=PartitionSet1,cn=ComPartitionSets,cn=System,dc=NA,dc=fabrikam,dc=com" 9 | objContainer.SetInfo 10 | -------------------------------------------------------------------------------- /modify account page information.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Account Page Information for a User Account 2 | 3 | 4 | Set objUser = GetObject _ 5 |   ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 6 | 7 | objUser.Put "userPrincipalName", "MyerKen@fabrikam.com" 8 | objUser.Put "sAMAccountName", "MyerKen01" 9 | objUser.Put "userWorkstations","wks1,wks2,wks3" 10 | objUser.SetInfo 11 | -------------------------------------------------------------------------------- /modify address page information for user account.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Address Page Information for a User Account 2 | 3 | 4 | Const ADS_PROPERTY_UPDATE = 2 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objUser.Put "streetAddress", "Building 43" & vbCrLf & "One Microsoft Way" 10 | objUser.Put "l", "Redmond" 11 | objUser.Put "st", "Washington" 12 | objUser.Put "postalCode", "98053" 13 | objUser.Put "c", "US" 14 | objUser.PutEx ADS_PROPERTY_UPDATE, _ 15 |     "postOfficeBox", Array("2222", "2223", "2224") 16 | objUser.SetInfo 17 | -------------------------------------------------------------------------------- /modify attributes.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Modify Computer Location Attribute 3 | 4 | 5 | Set objComputer = GetObject _ 6 |     ("LDAP://CN=atl-dc-01,CN=Computers,DC=fabrikam,DC=com") 7 | 8 | objComputer.Put "Location" , "Building 37, Floor 2, Room 2133" 9 | objComputer.SetInfo 10 | -------------------------------------------------------------------------------- /modify com+ information for user account.vbs: -------------------------------------------------------------------------------- 1 | ' Modify COM+ Information for a User Account 2 | 3 | 4 | Set objUser = GetObject _ 5 |   ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 6 | 7 | objUser.Put "msCOM-UserPartitionSetLink", _ 8 |   "cn=PartitionSet1,cn=ComPartitionSets,cn=System,dc=NA,dc=fabrikam,dc=com" 9 | objUser.SetInfo 10 | -------------------------------------------------------------------------------- /modify expiration date.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Modify the Expiration Date for a User Account 3 | 4 | 5 | Set objUser = GetObject _ 6 |   ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 7 | 8 | objUser.AccountExpirationDate = "03/30/2005" 9 | objUser.SetInfo 10 | -------------------------------------------------------------------------------- /modify general properties.vbs: -------------------------------------------------------------------------------- 1 | ' Modify the General Properties of an OU 2 | 3 | 4 | Const ADS_PROPERTY_UPDATE = 2 5 | 6 | Set objContainer = GetObject _ 7 |     ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objContainer.Put "street", "Building 43" & vbCrLf & "One Microsoft Way" 10 | objContainer.Put "l", "Redmond" 11 | objContainer.Put "st", "Washington" 12 | objContainer.Put "postalCode", "98053" 13 | objContainer.Put "c", "US" 14 | objContainer.PutEx ADS_PROPERTY_UPDATE, _ 15 |     "description", Array("Sales staff") 16 | objContainer.SetInfo 17 | -------------------------------------------------------------------------------- /modify group attributes.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Modify Group Attributes 3 | 4 | 5 | Const ADS_PROPERTY_UPDATE = 2 6 | 7 | Set objGroup = GetObject _ 8 |    ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 9 | 10 | objGroup.Put "sAMAccountName", "Scientist01" 11 | objGroup.Put "mail", "YoungRob@fabrikam.com" 12 | objGroup.Put "info", "Use this group for official communications " & _ 13 |   "with scientists who are contracted to work with Contoso.com." 14 | objGroup.PutEx ADS_PROPERTY_UPDATE, _ 15 |     "description", Array("Scientist Mailing List") 16 | objGroup.SetInfo 17 | -------------------------------------------------------------------------------- /modify group type.vbs: -------------------------------------------------------------------------------- 1 | ' Modify Group Type 2 | 3 | 4 | Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2 5 | Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4 6 | Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8 7 | Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000 8 | 9 | Set objGroup = GetObject _ 10 |     ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 11 | 12 | objGroup.Put "groupType", _ 13 |     ADS_GROUP_TYPE_UNIVERSAL_GROUP + ADS_GROUP_TYPE_SECURITY_ENABLED 14 | objGroup.SetInfo 15 | -------------------------------------------------------------------------------- /modify odbc default value when reading text files.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Modify the ODBC Default Value to Comma-Delimited When Reading Text Files 3 | 4 | 5 | Const HKEY_LOCAL_MACHINE = &H80000002 6 | 7 | strComputer = "." 8 | Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 9 |     strComputer & "\root\default:StdRegProv") 10 | 11 | strKeyPath = "SOFTWARE\Microsoft\Jet\4.0\Engines\Text" 12 | strValueName = "Format" 13 | strValue = "CSVDelimited" 14 | objReg.SetStringValue _ 15 |     HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue 16 | -------------------------------------------------------------------------------- /modify odbc default value.vbs: -------------------------------------------------------------------------------- 1 | ' Modify the ODBC Default Value to Tab-Delimited When Reading Text Files 2 | 3 | 4 | Const HKEY_LOCAL_MACHINE = &H80000002 5 | 6 | strComputer = "." 7 | Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 8 |     strComputer & "\root\default:StdRegProv") 9 | 10 | strKeyPath = "SOFTWARE\Microsoft\Jet\4.0\Engines\Text" 11 | strValueName = "Format" 12 | strValue = "TabDelimited" 13 | objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue 14 | -------------------------------------------------------------------------------- /modify upn suffixes.vbs: -------------------------------------------------------------------------------- 1 | ' Modify the UPN Suffixes Defined in the Forest 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objPartitions = GetObject _ 7 |     ("LDAP://cn=Partitions,cn=Configuration,dc=fabrikam,dc=com") 8 | 9 | objPartitions.PutEx ADS_PROPERTY_APPEND, _ 10 |     "upnSuffixes", Array("sa.fabrikam.com","corp.fabrikam.com") 11 | objPartitions.SetInfo 12 | -------------------------------------------------------------------------------- /modify user account address attributes.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Modify User Account Address Attributes 3 | 4 | 5 | Set objUser = GetObject _ 6 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 7 | 8 | objUser.Put "streetAddress", "Building 43" & _ 9 |     VbCrLf & "One Microsoft Way" 10 | objUser.Put "l", "Redmond" 11 | objUser.Put "st", "Washington" 12 | objUser.Put "postalCode", "98053" 13 | objUser.Put "c", "US" 14 | objUser.Put "postOfficeBox", "2222" 15 | objUser.SetInfo 16 | -------------------------------------------------------------------------------- /modify user account general properties.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Modify User Account General Properties 3 | 4 | 5 | Set objUser = GetObject _ 6 |   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 7 | 8 | objUser.Put "userPrincipalName", "MyerKen@fabrikam.com" 9 | objUser.Put "sAMAccountName", "MyerKen01" 10 | objUser.Put "userWorkstations", "wks1,wks2,wks3" 11 | objUser.SetInfo 12 | -------------------------------------------------------------------------------- /modify user profile paths.vbs: -------------------------------------------------------------------------------- 1 | ' Modify User Profile Paths 2 | 3 | 4 | Set objUser = GetObject _ 5 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 6 | 7 | strCurrentProfilePath = objUser.Get("profilePath") 8 | intStringLen = Len(strCurrentProfilePath) 9 | intStringRemains = intStringLen - 11 10 | strRemains = Mid(strCurrentProfilePath, 12, intStringRemains) 11 | strNewProfilePath = "\\fabrikam" & strRemains 12 | objUser.Put "profilePath", strNewProfilePath 13 | objUser.SetInfo 14 | -------------------------------------------------------------------------------- /modify user profile properties.vbs: -------------------------------------------------------------------------------- 1 | ' Modify User Profile Properties 2 | 3 | 4 | 5 | Set objUser = GetObject _ 6 |   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 7 | 8 | objUser.Put "profilePath", "\\sea-dc-01\Profiles\myerken" 9 | objUser.Put "scriptPath", "logon.bat" 10 | objUser.Put "homeDirectory", "\\sea-dc-01\HomeFolders\myerken" 11 | objUser.Put "homeDrive", "H:" 12 | objUser.SetInfo 13 | -------------------------------------------------------------------------------- /monitor active directory database performance.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Monitor Active Directory Database Performance 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:" _ 7 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 8 | 9 | Set colDatabases = objWMIService.ExecQuery _ 10 |     ("Select * from Win32_PerfFormattedData_Esent_Database " _ 11 |         & "Where Name = 'NT Directory'") 12 | 13 | For Each objADDatabase in colDatabases 14 |     Wscript.Echo "Database cache hit percent: " & _ 15 |         objADDatabase.DatabaseCachePercentHit 16 | Next 17 | -------------------------------------------------------------------------------- /monitor domain controller performance.vbs: -------------------------------------------------------------------------------- 1 | ' Monitor Domain Controller Performance 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colDatabases = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_PerfFormattedData_NTDS_NTDS") 10 | 11 | For Each objADDatabase in colDatabases 12 |     Wscript.Echo "DS threads in use: " & objADDatabase.DSThreadsInUse 13 |     Wscript.Echo "LDAP bind time: " & objADDatabase.LDAPBindTime 14 |     Wscript.Echo "LDAP client sessions: " & objADDatabase.LDAPClientSessions 15 | Next 16 | -------------------------------------------------------------------------------- /monitor fax server activity.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Monitor Fax Server Activity 4 | 5 | 6 | Set objFaxServer = CreateObject("FaxComEx.FaxServer") 7 | objFaxServer.Connect "atl-dc-02" 8 | 9 | Set objfaxActivity = objFaxServer.Activity 10 | 11 | Wscript.Echo "Incoming messages: " & objFaxActivity.IncomingMessages 12 | Wscript.Echo "Outgoing messages: " & objFaxActivity.OutgoingMessages 13 | Wscript.Echo "Queued messages: " & objFaxActivity.QueuedMessages 14 | Wscript.Echo "Routing messages: " & objFaxActivity.RoutingMessages 15 | -------------------------------------------------------------------------------- /move a user account to new domain.vbs: -------------------------------------------------------------------------------- 1 | ' Move a User Account to a New Domain 2 | 3 | 4 | Set objOU = GetObject("LDAP://ou=management,dc=na,dc=fabrikam,dc=com") 5 | 6 | objOU.MoveHere _ 7 |     "LDAP://cn=AckermanPilar,OU=management,dc=fabrikam,dc=com", vbNullString 8 | -------------------------------------------------------------------------------- /move a user account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Move a User Account 3 | 4 | 5 | Set objOU = GetObject("LDAP://ou=sales,dc=na,dc=fabrikam,dc=com") 6 | 7 | objOU.MoveHere _ 8 |     "LDAP://cn=BarrAdam,OU=hr,dc=na,dc=fabrikam,dc=com", vbNullString 9 | -------------------------------------------------------------------------------- /move account domain.vbs: -------------------------------------------------------------------------------- 1 | ' Move a Computer Account to a New Domain 2 | 3 | 4 | Set objOU = GetObject("LDAP://cn=Computers,dc=NA,dc=fabrikam,dc=com") 5 | 6 | objOU.MoveHere "LDAP://cn=Computer01,cn=Users,dc=fabrikam,dc=com", _ 7 |     vbNullString 8 | -------------------------------------------------------------------------------- /move account.vbs: -------------------------------------------------------------------------------- 1 | ' Move a Computer Account 2 | 3 | 4 | Set objNewOU = GetObject("LDAP://OU=Finance,DC=fabrikam,DC=com") 5 | 6 | Set objMoveComputer = objNewOU.MoveHere _ 7 |     ("LDAP://CN=atl-pro-03,CN=Computers,DC=fabrikam,DC=com", "CN=atl-pro-03") 8 | -------------------------------------------------------------------------------- /move domain controller.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Move a Domain Controller to a New Active Directory Site 3 | 4 | 5 | strSourceSiteRDN = "cn=Default-First-Site-Name" 6 | strTargetSiteRDN = "cn=Ga-Atl-Sales" 7 | strDcRDN         = "cn=atl-dc-01" 8 | 9 | Set objRootDSE = GetObject("LDAP://RootDSE") 10 | strConfigurationNC = objRootDSE.Get("configurationNamingContext") 11 | 12 | strDcPath = "LDAP://" & strDcRDN & ",cn=Servers," & strSourceSiteRDN & _ 13 |     ",cn=Sites," & strConfigurationNC 14 | 15 | strTargetSitePath = "LDAP://cn=Servers," & strTargetSiteRDN & _ 16 |     ",cn=Sites," & strConfigurationNC 17 | 18 | Set objTargetSite = GetObject(strTargetSitePath) 19 | objTargetSite.MoveHere strDcPath, strDcRDN 20 | -------------------------------------------------------------------------------- /move group within domain.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Move a Group Within a Domain 3 | 4 | 5 | Set objOU = GetObject("LDAP://cn=Users,dc=NA,dc=fabrikam,dc=com") 6 | 7 | objOU.MoveHere "LDAP://cn=atl-users,ou=HR,dc=NA,dc=fabrikam,dc=com", _ 8 |     vbNullString 9 | -------------------------------------------------------------------------------- /new members security group.vbs: -------------------------------------------------------------------------------- 1 | ' Add New Members to a Security Group 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objGroup = GetObject _ 7 |   ("LDAP://cn=Sea-Users,cn=Users,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objGroup.PutEx ADS_PROPERTY_APPEND, "member", _ 10 |     Array("cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com", _ 11 |         "cn=Executives,ou=Management,dc=NA,dc=fabrikam,dc=com", _ 12 |             "cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 13 | 14 | objGroup.SetInfo 15 | -------------------------------------------------------------------------------- /non expiring password.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Create a Non-Expiring Password 3 | 4 | 5 | Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 9 | intUAC = objUser.Get("userAccountControl") 10 | 11 | If ADS_UF_DONT_EXPIRE_PASSWD AND intUAC Then 12 |     Wscript.Echo "Already enabled" 13 | Else 14 |     objUser.Put "userAccountControl", intUAC XOR _ 15 |         ADS_UF_DONT_EXPIRE_PASSWD 16 |     objUser.SetInfo 17 |     WScript.Echo "Password never expires is now enabled" 18 | End If 19 | -------------------------------------------------------------------------------- /notepad.vbs: -------------------------------------------------------------------------------- 1 | Set obiShell = Wscript.CreateObject("WScript.Shell") 2 | obiShell.run "%SystemRoot%\system32\notepad.exe" 3 | -------------------------------------------------------------------------------- /ntds performance.vbs: -------------------------------------------------------------------------------- 1 | ' Monitor NTDS Performance 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | set objRefresher = CreateObject("WbemScripting.SWbemRefresher") 9 | Set colItems = objRefresher.AddEnum _ 10 |     (objWMIService, "Win32_PerfFormattedData_NTDS_NTDS").objectSet 11 | objRefresher.Refresh 12 | 13 | For i = 1 to 5 14 |     For Each objItem in colItems 15 |     Wscript.Echo "Directory service threads in use: " & _ 16 |         objItem.DSThreadsInUse 17 |     Wscript.Sleep 2000 18 |     objRefresher.Refresh 19 |     Next 20 | Next 21 | -------------------------------------------------------------------------------- /open website.vbs: -------------------------------------------------------------------------------- 1 | DIM C 2 | Set C=CreateObject("Shell.Application") 3 | C.ShellExecute "browser.exe","https://www.youtube.com","","",1 4 | 'browser.exe must be set to chrome.exe, msedge.exe, brave.exe, firefox.exe etc. 5 | -------------------------------------------------------------------------------- /other groups.vbs: -------------------------------------------------------------------------------- 1 | ' List Other Groups a Group Belongs To 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objGroup = GetObject _ 7 |     ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 8 | objGroup.GetInfo 9 | 10 | arrMembersOf = objGroup.GetEx("memberOf") 11 | 12 | WScript.Echo "MembersOf:" 13 | For Each strMemberOf in arrMembersOf 14 |     WScript.Echo strMemberOf 15 | Next 16 | -------------------------------------------------------------------------------- /owner of group.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List the Owner of a Group 3 | 4 | 5 | Set objGroup = GetObject _ 6 |   ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 7 | 8 | Set objNtSecurityDescriptor = objGroup.Get("ntSecurityDescriptor") 9 | 10 | WScript.Echo "Owner Tab" 11 | WScript.Echo "Current owner of this item: " & objNtSecurityDescriptor.Owner 12 | -------------------------------------------------------------------------------- /pause indexing service.vbs: -------------------------------------------------------------------------------- 1 | ' Pause the Indexing Service 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | objAdminIS.Pause() 8 | -------------------------------------------------------------------------------- /premium.vbs: -------------------------------------------------------------------------------- 1 | x=msgbox("Do You Want To Purchase Premium?", 4+32, "Purchase Premium") 2 | if x=6 then 3 | x=msgbox("Cannot Connect To Site", 0+16, "Purchase Premium") 4 | end if 5 | if x=7 then 6 | end if 7 | -------------------------------------------------------------------------------- /prevent password storing.vbs: -------------------------------------------------------------------------------- 1 | ' Prevent Passwords from Being Stored Using Reversible Encrypted Text 2 | 3 | 4 | Const ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED = &H80 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 8 | intUAC = objUser.Get("userAccountControl") 9 | 10 | If intUAC AND _ 11 |     ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED Then 12 |         objUser.Put "userAccountControl", intUAC XOR _ 13 |             ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 14 |         objUser.SetInfo 15 | End If 16 | -------------------------------------------------------------------------------- /read comma seperated text file.vbs: -------------------------------------------------------------------------------- 1 | 'Read a Comma Separated text file 2 | 'You should create a schema information file (schema.ini) in the same directory 3 | 4 | Set objConn = CreateObject("ADODB.Connection") 5 | 6 | Set shell = CreateObject( "WScript.Shell" ) 7 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 8 | 9 | objConn.open "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & ";Extended Properties=""Text;"";" 10 | 11 | Set ors = objConn.Execute("select * from [cities_comma.txt]") 12 | 13 | Do While Not(ors.EOF) 14 |   WScript.Echo ors("city").Value & " " & ors("Latitude").Value & " " & ors("Longitude").Value 15 |   ors.MoveNext 16 | Loop 17 | 18 | ors.Close 19 | -------------------------------------------------------------------------------- /read entire text file.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' Read an Entire Text File 4 | 5 | Const ForReading = 1 6 | 7 | Set objFSO = CreateObject("Scripting.FileSystemObject") 8 | Set objTextFile = objFSO.OpenTextFile("c:\temp\myfile.txt", ForReading) 9 | 10 | contents = objTextFile.ReadAll 11 | objTextFile.Close 12 | 13 | WScript.Echo contents 14 | -------------------------------------------------------------------------------- /read n-th line of text file.vbs: -------------------------------------------------------------------------------- 1 | ' Read n-th Line of a Text File 2 | 3 | 4 | 5 | Const FOR_READING = 1 6 | strFilePath = "C:\scripts\test.txt" 7 | iLineNumber = 5 8 | 9 | Set objFS = CreateObject("Scripting.FileSystemObject") 10 | Set objTS = objFS.OpenTextFile(strFilePath, FOR_READING) 11 | 12 | For i=1 To (iLineNumber-1) 13 |    objTS.SkipLine 14 | Next 15 | 16 | WScript.Echo objTS.Readline 17 | -------------------------------------------------------------------------------- /read semicolon text file.vbs: -------------------------------------------------------------------------------- 1 | 'Read a Semicolon Separated text file 2 | 'You should create a schema information file (schema.ini) in the same directory 3 | 4 | Set objConn = CreateObject("ADODB.Connection") 5 | 6 | Set shell = CreateObject( "WScript.Shell" ) 7 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 8 | 9 | objConn.open "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & ";Extended Properties=""Text;"";" 10 | 11 | Set ors = objConn.Execute("select * from [cities_semicolon.txt]") 12 | 13 | Do While Not(ors.EOF) 14 |   WScript.Echo ors("city").Value & " " & ors("Latitude").Value & " " & ors("Longitude").Value 15 |   ors.MoveNext 16 | Loop 17 | 18 | ors.Close 19 | -------------------------------------------------------------------------------- /read tab seperated text file.vbs: -------------------------------------------------------------------------------- 1 | 'Read a Tab Separated text file 2 | 'You should create a schema information file (schema.ini) in the same directory 3 | 4 | Set objConn = CreateObject("ADODB.Connection") 5 | 6 | Set shell = CreateObject( "WScript.Shell" ) 7 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 8 | 9 | objConn.open "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & ";Extended Properties=""Text;"";" 10 | 11 | Set ors = objConn.Execute("select * from [cities_tab.txt]") 12 | 13 | Do While Not(ors.EOF) 14 |   WScript.Echo ors("city").Value & " " & ors("Latitude").Value & " " & ors("Longitude").Value 15 |   ors.MoveNext 16 | Loop 17 | 18 | ors.Close 19 | -------------------------------------------------------------------------------- /read text file backwards.vbs: -------------------------------------------------------------------------------- 1 | ' Read a Text File from the Bottom Up 2 | 3 | 4 | Dim arrFileLines() 5 | i = 0 6 | 7 | Set objFSO = CreateObject("Scripting.FileSystemObject") 8 | Set objFile = objFSO.OpenTextFile("C:\FSO\ScriptLog.txt", 1) 9 | 10 | Do Until objFile.AtEndOfStream 11 |      Redim Preserve arrFileLines(i) 12 |      arrFileLines(i) = objFile.ReadLine 13 |      i = i + 1 14 | Loop 15 | 16 | objFile.Close 17 | 18 | For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1 19 |     Wscript.Echo arrFileLines(l) 20 | Next 21 | -------------------------------------------------------------------------------- /read text file character by character.vbs: -------------------------------------------------------------------------------- 1 | ' Read a Text File Character-by-Character 2 | 3 | 4 | Set objFSO = CreateObject("Scripting.FileSystemObject") 5 | 6 | Set objFile = objFSO.OpenTextFile("C:\FSO\New Text Document.txt", 1) 7 | Do Until objFile.AtEndOfStream 8 |     strCharacters = objFile.Read(1) 9 |     Wscript.Echo strCharacters 10 | Loop 11 | -------------------------------------------------------------------------------- /read text file into array.vbs: -------------------------------------------------------------------------------- 1 | ' Read a Text File into an Array 2 | 3 | 4 | Const ForReading = 1 5 | 6 | Set objFSO = CreateObject("Scripting.FileSystemObject") 7 | Set objTextFile = objFSO.OpenTextFile _ 8 |     ("c:\scripts\servers and services.txt", ForReading) 9 | 10 | Do Until objTextFile.AtEndOfStream 11 |     strNextLine = objTextFile.Readline 12 |     arrServiceList = Split(strNextLine , ",") 13 |     Wscript.Echo "Server name: " & arrServiceList(0) 14 |     For i = 1 to Ubound(arrServiceList) 15 |         Wscript.Echo "Service: " & arrServiceList(i) 16 |     Next 17 | Loop 18 | -------------------------------------------------------------------------------- /remain active directory site.vbs: -------------------------------------------------------------------------------- 1 | ' Rename an Active Directory Site 2 | 3 | 4 | strOldSiteRDN = "cn=Default-First-Site-Name" 5 | strNewSiteRDN = "cn=Ga-Atl-Sales" 6 | 7 | Set objRootDSE = GetObject("LDAP://RootDSE") 8 | strConfigurationNC = objRootDSE.Get("configurationNamingContext") 9 | 10 | strSitesContainer = "LDAP://cn=Sites," & strConfigurationNC 11 | strOldSitePath = "LDAP://" & strOldSiteRDN & ",cn=Sites," & strConfigurationNC 12 | 13 | Set objSitesContainer = GetObject(strSitesContainer) 14 | objSitesContainer.MoveHere strOldSitePath, strNewSiteRDN 15 | -------------------------------------------------------------------------------- /remove all members of group.vbs: -------------------------------------------------------------------------------- 1 | ' Remove All the Members of a Group 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objGroup = GetObject _ 7 |     ("LDAP://cn=Sea-Users,cn=Users,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objGroup.PutEx ADS_PROPERTY_CLEAR, "member", 0 10 | objGroup.SetInfo 11 | -------------------------------------------------------------------------------- /remove group manager.vbs: -------------------------------------------------------------------------------- 1 | ' Remove the Manager of a Group 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objGroup = GetObject _ 7 |    ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objGroup.PutEx ADS_PROPERTY_CLEAR, "managedBy", 0 10 | objGroup.SetInfo 11 | -------------------------------------------------------------------------------- /remove ou manager.vbs: -------------------------------------------------------------------------------- 1 | ' Remove an OU Manager 2 | 3 | 4 | Const ADS_PROPERTY_CLEAR = 1 5 | 6 | Set objContainer = GetObject _ 7 |   ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 8 | 9 | objContainer.PutEx ADS_PROPERTY_CLEAR, "managedBy", 0 10 | objContainer.SetInfo 11 | -------------------------------------------------------------------------------- /remove user from group.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Remove a User from a Group 3 | 4 | 5 | Const ADS_PROPERTY_DELETE = 4 6 | 7 | Set objGroup = GetObject _ 8 |    ("LDAP://cn=Sea-Users,cn=Users,dc=NA,dc=fabrikam,dc=com") 9 | 10 | objGroup.PutEx ADS_PROPERTY_DELETE, _ 11 |     "member",Array("cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 12 | objGroup.SetInfo 13 | 14 | -------------------------------------------------------------------------------- /remove utf-16 byte order mark.vbs: -------------------------------------------------------------------------------- 1 | ' Remove UTF-16 Byte Order Mark (BOM) from a text file 2 | 3 | Set toolkit = CreateObject("Vbsedit.Toolkit") 4 | toolkit.RemoveBOM "C:\my_utf8_file.txt" 5 | -------------------------------------------------------------------------------- /remove utf8 byte order mark.vbs: -------------------------------------------------------------------------------- 1 | 2 | Set toolkit = CreateObject("Vbsedit.Toolkit") 3 | toolkit.RemoveBOM "C:\my_utf8_file.txt" 4 | -------------------------------------------------------------------------------- /rename account.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Rename a Computer Account 3 | 4 | 5 | Set objNewOU = GetObject("LDAP://OU=Finance,DC=fabrikam,DC=com") 6 | 7 | Set objMoveComputer = objNewOU.MoveHere _ 8 |     ("LDAP://CN=atl-pro-037,OU=Finance,DC=fabrikam,DC=com", _ 9 |         "CN=atl-pro-003") 10 | -------------------------------------------------------------------------------- /rename both.vbs: -------------------------------------------------------------------------------- 1 | ' Rename a Computer and Computer Account 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colComputers = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_ComputerSystem") 10 | 11 | For Each objComputer in colComputers 12 |     err = objComputer.Rename("WebServer") 13 | Next 14 | -------------------------------------------------------------------------------- /replace group members.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Replace Group Membership with All-New Members 3 | 4 | 5 | Const ADS_PROPERTY_UPDATE = 2 6 | 7 | Set objGroup = GetObject _ 8 |     ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 9 | 10 | objGroup.PutEx ADS_PROPERTY_UPDATE, "member", _ 11 |       Array("cn=YoungRob,ou=R&D,dc=NA,dc=fabrikam,dc=com", _ 12 |           "cn=ShenAlan,ou=R&D,dc=NA,dc=fabrikam,dc=com") 13 | objGroup.SetInfo 14 | -------------------------------------------------------------------------------- /require password change.vbs: -------------------------------------------------------------------------------- 1 | ' Require Users to Change Their Password 2 | 3 | 4 | Set objUser = GetObject _ 5 |     ("LDAP://CN=myerken,OU=management,DC=Fabrikam,DC=com") 6 | 7 | objUser.Put "pwdLastSet", 0 8 | objUser.SetInfo 9 | -------------------------------------------------------------------------------- /require smartcard.vbs: -------------------------------------------------------------------------------- 1 | ' Require a User to Logon on Using a Smartcard 2 | 3 | 4 | Const ADS_UF_SMARTCARD_REQUIRED = &h40000 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 8 | 9 | intUAC = objUser.Get("userAccountControl") 10 | 11 | If (intUAC AND ADS_UF_SMARTCARD_REQUIRED) = 0 Then 12 |     objUser.Put "userAccountControl", intUAC XOR ADS_UF_SMARTCARD_REQUIRED 13 |     objUser.SetInfo 14 | End If 15 | -------------------------------------------------------------------------------- /reset password.vbs: -------------------------------------------------------------------------------- 1 | ' Reset a Computer Account Password 2 | 3 | 4 | Set objComputer = GetObject _ 5 |     ("LDAP://CN=atl-dc-01,CN=Computers,DC=Reskit,DC=COM") 6 | 7 | objComputer.SetPassword "atl-dc-01$" 8 | -------------------------------------------------------------------------------- /resume indexing service.vbs: -------------------------------------------------------------------------------- 1 | ' Resume the Indexing Service 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | objAdminIS.Continue() 8 | -------------------------------------------------------------------------------- /sample accounts.vbs: -------------------------------------------------------------------------------- 1 | ' Create 1000 Sample User Accounts 2 | 3 | 4 | Set objRootDSE = GetObject("LDAP://rootDSE") 5 | 6 | Set objContainer = GetObject("LDAP://cn=Users," & _ 7 |     objRootDSE.Get("defaultNamingContext")) 8 | 9 | For i = 1 To 1000 10 |     Set objLeaf = objContainer.Create("User", "cn=UserNo" & i) 11 |     objLeaf.Put "sAMAccountName", "UserNo" & i 12 |     objLeaf.SetInfo 13 | Next 14 | 15 | WScript.Echo "1000 Users created." 16 | -------------------------------------------------------------------------------- /scope of security group.vbs: -------------------------------------------------------------------------------- 1 | ' Change the Scope of a Security Group 2 | 3 | 4 | Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2 5 | Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4 6 | Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8 7 | Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000 8 | 9 | Set objGroup = GetObject _ 10 |     ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com") 11 | 12 | objGroup.Put "groupType", _ 13 |     ADS_GROUP_TYPE_GLOBAL_GROUP + ADS_GROUP_TYPE_SECURITY_ENABLED 14 | 15 | objGroup.SetInfo 16 | -------------------------------------------------------------------------------- /security groups.vbs: -------------------------------------------------------------------------------- 1 | ' Add a User to Two Security Groups 2 | 3 | 4 | Const ADS_PROPERTY_APPEND = 3 5 | 6 | Set objGroup = GetObject _ 7 |     ("LDAP://cn=Atl-Users,cn=Users,dc=NA,dc=fabrikam,dc=com") 8 | objGroup.PutEx ADS_PROPERTY_APPEND, _ 9 |     "member", Array("cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 10 | objGroup.SetInfo 11 | 12 | Set objGroup = GetObject _ 13 |     ("LDAP://cn=NA-Employees,cn=Users,dc=NA,dc=fabrikam,dc=com")   14 | objGroup.PutEx ADS_PROPERTY_APPEND, _ 15 |     "member", Array("cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 16 | objGroup.SetInfo 17 | -------------------------------------------------------------------------------- /see when password changes.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List When a Password was Last Changed 3 | 4 | 5 | Set objUser = GetObject _ 6 |     ("LDAP://CN=myerken,OU=management,DC=Fabrikam,DC=com") 7 | 8 | dtmValue = objUser.PasswordLastChanged 9 | WScript.Echo "Password last changed: " & dtmValue 10 | -------------------------------------------------------------------------------- /select data from an sqlite database.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Select data from an SQLite database 3 | 4 | 5 | Set cn = CreateObject( "ADODB.Connection" ) 6 | 7 | Set shell = CreateObject( "WScript.Shell" ) 8 | folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\" 9 | 10 | cn.Open "Driver={SQLite3 ODBC Driver};Database=" & folder & "test.db;" 11 | 12 | Set rs= cn.Execute("select * from user") 13 | 14 | Do While Not(rs.EOF) 15 |   WScript.Echo rs("email").Value 16 |   rs.MoveNext 17 | Loop 18 | 19 | rs.Close 20 | cn.Close 21 | -------------------------------------------------------------------------------- /set userr account to never expire.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Set a User Account So It Never Expires 3 | 4 | 5 | Set objUser = GetObject _ 6 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 7 | 8 | objUser.AccountExpirationDate = "01/01/1970" 9 | objUser.SetInfo 10 | -------------------------------------------------------------------------------- /show computer model.vbs: -------------------------------------------------------------------------------- 1 | ' List Computer Manufacturer and Model 2 | 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 7 | Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") 8 | For Each objItem In colItems 9 |   WScript.Echo "Name: " & objItem.Name 10 |   WScript.Echo "Manufacturer: " & objItem.Manufacturer 11 |   WScript.Echo "Model: " & objItem.Model 12 | Next 13 | -------------------------------------------------------------------------------- /show language.vbs: -------------------------------------------------------------------------------- 1 | ' List Locale and Language Information 2 | 3 | 4 | 5 | strComputer = "." 6 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 7 | Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem") 8 | For Each objItem In colItems 9 |   WScript.Echo "Country Code: " & objItem.CountryCode 10 |   WScript.Echo "Locale: " & objItem.Locale 11 |   WScript.Echo "OS Language: " & objItem.OSLanguage 12 |   WScript.Echo "Code Set: " & objItem.CodeSet 13 | Next 14 | -------------------------------------------------------------------------------- /site name for local computer.vbs: -------------------------------------------------------------------------------- 1 | ' List the Site Name for the Local Computer 2 | 3 | 4 | Set objADSysInfo = CreateObject("ADSystemInfo") 5 | 6 | WScript.Echo "Current site name: " & objADSysInfo.SiteName 7 | -------------------------------------------------------------------------------- /specified files included in indexing service.vbs: -------------------------------------------------------------------------------- 1 | ' List Specific Files Included in the Indexing Service 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objConnection = CreateObject("ADODB.Connection") 7 | objConnection.ConnectionString = "provider=msidxs;" 8 | objConnection.Properties("Data Source") = "Script Catalog" 9 | objConnection.Open 10 | 11 | Set objCommand = CreateObject("ADODB.Command") 12 | 13 | strQuery = "Select Filename from Scope()" 14 | 15 | Set objRecordSet = objConnection.Execute(strQuery) 16 | 17 | Do While Not objRecordSet.EOF 18 |     Wscript.Echo objRecordSet("Filename") 19 |     objRecordSet.MoveNext 20 | Loop 21 | -------------------------------------------------------------------------------- /start indexing service.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Start the Indexing Service 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 8 | objAdminIS.Start() 9 | -------------------------------------------------------------------------------- /stop indexing service.vbs: -------------------------------------------------------------------------------- 1 | ' Stop the Indexing Service 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objAdminIS = CreateObject("Microsoft.ISAdm") 7 | objAdminIS.Stop() 8 | -------------------------------------------------------------------------------- /subtraction.vbs: -------------------------------------------------------------------------------- 1 | 'Option Explicit 2 | 'Dim firstNumber 3 | 'Assign first number 4 | firstNumber=InputBox("Please enter a number to subtract:","First number") 5 | firstNumber=Cint(firstNumber) 6 | 'Dim secondNumber 7 | 'Assign second number 8 | secondNumber=Cint(InputBox("Please enter the second number to subtract"& vbCrLf&"to the sum","Second number",0)) 9 | 'Store sum to the third variable 10 | 'Dim sum 11 | sum=FirstNumber-SecondNumber 12 | 'Display sum 13 | MsgBox "The sum is " & sum 14 | -------------------------------------------------------------------------------- /system restore.vbs: -------------------------------------------------------------------------------- 1 | localdate=date() 2 | set SRP = getobject("winmgmts:\\.\root\default:Systemrestore") 3 | CSRP = SRP.createrestorepoint ("System Start-up - " & localdate, 0, 100) 4 | -------------------------------------------------------------------------------- /text to speech.vbs: -------------------------------------------------------------------------------- 1 | do 2 | Dim message, sapi 3 | message=InputBox("What do you want me to say?","Eggy115's Voice Generator") 4 | Set sapi=CreateObject("sapi.spvoice") 5 | sapi.Speak message 6 | loop 7 | -------------------------------------------------------------------------------- /typing hack.vbs: -------------------------------------------------------------------------------- 1 | Set wshShell =wscript.CreateObject("WScript.Shell") 2 | wscript.sleep 2000 3 | wshshell.sendkeys "Put any kind of text here" 4 | -------------------------------------------------------------------------------- /universal distribution group.vbs: -------------------------------------------------------------------------------- 1 | ' Create a Universal Distribution Group 2 | 3 | 4 | Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8 5 | 6 | Set objOU = GetObject("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com") 7 | Set objGroup = objOU.Create("Group", "cn=Customers") 8 | 9 | objGroup.Put "sAMAccountName", "customers" 10 | objGroup.Put "groupType", ADS_GROUP_TYPE_UNIVERSAL_GROUP 11 | objGroup.SetInfo 12 | -------------------------------------------------------------------------------- /universal security group.vbs: -------------------------------------------------------------------------------- 1 | ' Create a Universal Security Group 2 | 3 | 4 | Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8 5 | Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000 6 | 7 | Set objOU = GetObject("LDAP://cn=Users,dc=NA,dc=fabrikam,dc=com") 8 | Set objGroup = objOU.Create("Group", "cn=All-Employees") 9 | 10 | objGroup.Put "sAMAccountName", "AllEmployees" 11 | objGroup.Put "groupType", ADS_GROUP_TYPE_UNIVERSAL_GROUP Or _ 12 |     ADS_GROUP_TYPE_SECURITY_ENABLED 13 | objGroup.SetInfo 14 | -------------------------------------------------------------------------------- /unjoin computer.vbs: -------------------------------------------------------------------------------- 1 | ' Unjoin a Computer from a Domain 2 | 3 | 4 | 5 | Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain. 6 | strPassword = "password" 7 | strUser = "kenmyer" 8 | 9 | Set objNetwork = CreateObject("WScript.Network") 10 | strComputer = objNetwork.ComputerName 11 | 12 | Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _ 13 | strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'") 14 | strDomain = objComputer.Domain 15 | intReturn = objComputer.UnjoinDomainOrWorkgroup _ 16 | (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE) 17 | -------------------------------------------------------------------------------- /unlock user account.vbs: -------------------------------------------------------------------------------- 1 | ' Unlock a User Account 2 | 3 | 4 | Set objUser = GetObject _ 5 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 6 | 7 | objUser.IsAccountLocked = False 8 | objUser.SetInfo 9 | -------------------------------------------------------------------------------- /upgrade software.vbs: -------------------------------------------------------------------------------- 1 | ' Upgrade Software 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colSoftware = objWMIService.ExecQuery _ 9 |     ("Select * from Win32__Product Where Name = 'Personnel Database'") 10 | 11 | For Each objSoftware in colSoftware 12 |     errReturn = objSoftware.Upgrade("c:\scripts\database2.msi") 13 | Next 14 | -------------------------------------------------------------------------------- /user account address page attributes.vbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ' List User Account Address Page Attributes 4 | 5 | 6 | On Error Resume Next 7 | 8 | Set objUser = GetObject _ 9 |   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 10 | 11 | WScript.Echo "Street Address: " & objUser.streetAddress 12 | WScript.Echo "Post Office Box: " & objUser.postOfficeBox 13 | WScript.Echo "Locality: " & objUser.l 14 | WScript.Echo "Street: " & objUser.st 15 | WScript.Echo "Postal Code: " & objUser.postalCode 16 | WScript.Echo "Country: " & objUser.c 17 | -------------------------------------------------------------------------------- /user account page properties.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List User Account Account Page Properties 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 9 | 10 | WScript.Echo "User Principal Name: " & objUser.userPrincipalName 11 | WScript.Echo "SAM Account Name: " & objUser.sAMAccountName 12 | WScript.Echo "User Workstations: " & objUser.userWorkstations 13 | 14 | Set objDomain = GetObject("LDAP://dc=fabrikam,dc=com") 15 | WScript.Echo "Domain controller: " & objDomain.dc 16 | -------------------------------------------------------------------------------- /user expiry date.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' List the Date That a User Account Expires 3 | 4 | 5 | On Error Resume Next 6 | 7 | Set objUser = GetObject _ 8 |     ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") 9 | 10 | dtmAccountExpiration = objUser.AccountExpirationDate 11 | 12 | If Err.Number = -2147467259 Or dtmAccountExpiration = "1/1/1970" Then 13 |     WScript.Echo "No account expiration date specified" 14 | Else 15 |     WScript.Echo "Account expiration date: " & objUser.AccountExpirationDate 16 | End If 17 | -------------------------------------------------------------------------------- /user profile properties.vbs: -------------------------------------------------------------------------------- 1 | ' List User Profile Properties 2 | 3 | 4 | On Error Resume Next 5 | 6 | Set objUser = GetObject _ 7 |     ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 8 | 9 | Wscript.Echo "Profile Path: " & objUser.ProfilePath 10 | Wscript.Echo "Script Path: " & objUser.ScriptPath 11 | Wscript.Echo "Home Directory: " & objUser.HomeDirectory 12 | Wscript.Echo "Home Drive: " & objUser.HomeDrive 13 | -------------------------------------------------------------------------------- /user status.vbs: -------------------------------------------------------------------------------- 1 | ' List the Status of a User 2 | 3 | 4 | Set objUser = GetObject _ 5 |   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 6 | 7 | If objUser.AccountDisabled = FALSE Then 8 |       WScript.Echo "The account is enabled." 9 | Else 10 |       WScript.Echo "The account is disabled." 11 | End If 12 | -------------------------------------------------------------------------------- /verify computer.vbs: -------------------------------------------------------------------------------- 1 | ' Verify that a Computer is a Global Catalog Server 2 | 3 | 4 | strComputer = "atl-dc-01" 5 | 6 | Const NTDSDSA_OPT_IS_GC = 1 7 | 8 | Set objRootDSE = GetObject("LDAP://" & strComputer & "/rootDSE") 9 | strDsServiceDN = objRootDSE.Get("dsServiceName") 10 | Set objDsRoot  = GetObject("LDAP://" & strComputer & "/" & strDsServiceDN) 11 | intOptions = objDsRoot.Get("options") 12 | 13 | If intOptions And NTDSDSA_OPT_IS_GC Then 14 |     WScript.Echo strComputer & " is a global catalog server." 15 | Else 16 |     Wscript.Echo strComputer & " is not a global catalog server." 17 | End If 18 | -------------------------------------------------------------------------------- /verify domain controller.vbs: -------------------------------------------------------------------------------- 1 | ' Verify that a Domain Controller is in a Site 2 | 3 | 4 | strDcName = "atl-dc-01" 5 | strSiteName = "ga-atl-sales" 6 | 7 | Set objADSysInfo = CreateObject("ADSystemInfo") 8 | strDcSiteName = objADSysInfo.GetDCSiteName(strDcName) 9 | 10 | If UCase(strSiteName) = UCase(strDcSiteName) Then 11 |     WScript.Echo "TRUE: " & strDcName & " is in site " & strSiteName 12 | Else 13 |     WScript.Echo "FALSE: " & strDcName & " is NOT in site " & strSiteName 14 | End If 15 | -------------------------------------------------------------------------------- /verify size of file.vbs: -------------------------------------------------------------------------------- 1 | ' Verify the Size of a File Before Reading It 2 | 3 | 4 | Set objFSO = CreateObject("Scripting.FileSystemObject") 5 | Set objFile = objFSO.GetFile("C:\Windows\Netlogon.log") 6 | 7 | If objFile.Size > 0 Then 8 |     Set objReadFile = objFSO.OpenTextFile("C:\Windows\Netlogon.log", 1) 9 |     strContents = objReadFile.ReadAll 10 |     Wscript.Echo strContents 11 |     objReadFile.Close 12 | Else 13 |     Wscript.Echo "The file is empty." 14 | End If 15 | 16 | -------------------------------------------------------------------------------- /verify sql server installation.vbs: -------------------------------------------------------------------------------- 1 | ' Verify That SQL Server is Installed on a Computer 2 | 3 | 4 | strComputer = "." 5 | Set objWMIService = GetObject("winmgmts:" _ 6 |     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 7 | 8 | Set colServices = objWMIService.ExecQuery _ 9 |     ("Select * from Win32_Service Where Name = 'MSSQLServer'") 10 | 11 | If colServices.Count > 0 Then 12 |     For Each objService in colServices 13 |         Wscript.Echo "SQL Server is " & objService.State & "." 14 |     Next 15 | Else 16 |     Wscript.Echo "SQL Server is not installed on this computer." 17 | End If 18 | -------------------------------------------------------------------------------- /writing data to text file.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Writing Data to a Text File 3 | 4 | 5 | Const ForAppending = 8 6 | 7 | Set objFSO = CreateObject("Scripting.FileSystemObject") 8 | Set objTextFile = objFSO.OpenTextFile _ 9 |     ("c:\scripts\service_status.txt", ForAppending, True) 10 | 11 | Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 12 |     strComputer & "\root\cimv2") 13 | Set colServices = objWMIService.ExecQuery("Select * from Win32_Service") 14 | 15 | For Each objService in colServices     16 |     objTextFile.WriteLine(objService.DisplayName & vbTab & _ 17 |         objService.State) 18 | Next 19 | objTextFile.Close 20 | -------------------------------------------------------------------------------- /writing data to txt file.vbs: -------------------------------------------------------------------------------- 1 | ' Writing Data to a Text File 2 | 3 | 4 | Const ForAppending = 8 5 | 6 | Set objFSO = CreateObject("Scripting.FileSystemObject") 7 | Set objTextFile = objFSO.OpenTextFile _ 8 |     ("c:\scripts\service_status.txt", ForAppending, True) 9 | 10 | Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 11 |     strComputer & "\root\cimv2") 12 | Set colServices = objWMIService.ExecQuery("Select * from Win32_Service") 13 | 14 | For Each objService in colServices     15 |     objTextFile.WriteLine(objService.DisplayName & vbTab & _ 16 |         objService.State) 17 | Next 18 | objTextFile.Close 19 | -------------------------------------------------------------------------------- /writing string content to beginning of text file.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Writing String Content to Beginning of Existing Text File 3 | 4 | 5 | 6 | Const FOR_READING = 1 7 | Const FOR_WRITING = 2 8 | 9 | strFileName = "C:\scripts\test.txt" 10 | strNewContent  = "sample string content" 11 | 12 | Set objFS = CreateObject("Scripting.FileSystemObject") 13 | Set objTS = objFS.OpenTextFile(strFileName,FOR_READING) 14 | strContents = objTS.ReadAll 15 | objTS.Close 16 | Set objTS = objFS.OpenTextFile(strFileName,FOR_WRITING) 17 | objTS.WriteLine strNewContent 18 | objTS.Write strContents 19 | -------------------------------------------------------------------------------- /writing string content.vbs: -------------------------------------------------------------------------------- 1 | 2 | ' Writing String Content to End of Existing Text File 3 | 4 | 5 | 6 | Const FOR_APPENDING = 8 7 | strFileName = "C:\scripts\testfile.txt" 8 | strContent  = "sample string content" 9 | 10 | Set objFS = CreateObject("Scripting.FileSystemObject") 11 | Set objTS = objFS.OpenTextFile(strFileName,FOR_APPENDING) 12 | objTS.Write strContent 13 | --------------------------------------------------------------------------------