Category filter

Code snippets for the most commonly executed tasks in Windows

You can execute custom scripts on Windows 10(v1703+) and Windows 11 PCs, enrolled in Hexnode using the Hexnode Installer App. Hexnode supports .bat, .cmd, .ps1 script formats. Here are some sample code snippets for the most commonly executed tasks in Windows that you might find useful:


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Serial No Script
1 Enable/Disable Firewall
2 Add Windows to AD domain
3 Change admin user to non-admin user
4 Restart device
5 Shutdown device
6 Install EXE app
7 Uninstall store apps
8 Uninstall Enterprise apps
9 Create users
10 Add user to group
11 Change password
12 Rename file
13 Delete file and folders
14 Display all users
15 OS Update
16 Copy text to clipboard
17 Download Files
18 Fetch List of previously connected Wi-Fi networks
19 Find File
20 Clear Password
21 Add Printers
22 Stop and Restart Windows Audio Service
23 Delete Certificate
24 Backup Files and Folders
25 Change Non-admin User to Admin User
26 Ping Website
27 Get Login Information of the last logged-in user
28 Whitelist/Blacklist Websites
29 Create Files and Folders
30 Create new folder if it doesn’t exist
31 Check Encryption Status of drives
32 View files and folders
33 Deploy Certificates
34 Change Screensaver Time
35 Copy Files/Folders
36 Create a New Folder and Add Shortcut
37 Clear Cache and Temporary Files
38 Fetch Windows device logs
39 Set Wallpaper
40 Fetch Browsing History
41 Set Screensaver
42 Clear Browsing History
43 Set up Cisco Umbrella Roaming Client
44 Collect Windows System Information
45 Set Time Zone
46 Automate login to a user account
47 Set screen time limits
48 Change Fonts
49 Allow access only to specific third-party apps
50 Wipe device
51 Disable/Enable Microsoft Accounts
52 Block app installation by standard users
53 Clear browser cache
54 Delete local user account(s)
55 Manage Google Chrome extensions
56 Obtain the history of user logons and logoffs
57 Configure file/folder permissions
58 Change date format
59 Disable automatic app updates
60 Change default browser
61 Collect MDM logs
62 Download and install driver updates
63 Change device name
64 Fetch BitLocker Recovery key
65 Download and install Google Chrome browser
66 List installed applications
67 Fetch battery status
68 Get available disk space
69 Fetch running processes
70 Fetch OS license details
71 Fetch info about drives
72 Force close apps
73 Find size of files in folder
  • Sample Script Repository