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:

Disclaimer:

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 Block 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 Fetch certificate details
73 Force close apps
74 Find size of files in folder
75 Disable/Enable Remote Desktop & Remote Assistance
76 Set homepage in Microsoft Edge
77 Change Bluetooth Status
78 Install or uninstall packages
79 Convert text to uppercase/lowercase
80 Find location of Windows device using IP address
81 Check certificate expiry
82 Get the MAC address
83 Install/Uninstall Firefox
84 Manage current working directory
85 Hide Restart option
86 Add content to files
87 Create self-signed certificate
88 Turn on/off location services
89 Manage registry keys
90 Enable/Disable Remote Desktop
91 Event logs of shutdown events
92 Block apps
93 Uninstall Chrome
94 Enable BitLocker
95 Disable BitLocker
96 Suspend or resume BitLocker protection
97 Start a process
98 Fetch location coordinates
99 Play beep sound
100 Controlled folder access
101 Hide Sleep option from the Start menu
102 Enable/ Disable Windows Sign-in options
103 Enroll Chrome browsers
104 Display Firewall profile settings
105 Convert text to speech
106 Manage registry entries
107 Clear cache for Teams app
108 Restart Google Chrome
109 Create a CSV file
110 Access the Downloads folder in multi-app kiosk
111 Fetch AUMID of apps
112 Hide Hibernate option from Start menu
113 Find, remove/rename files with duplicate filenames
114 Turn on/off keyboard shortcuts
115 Schedule notifications
116 Enable/Disable WinRE
117 Fetch performance details
118 Set/Update active hours
119 Enable/Disable Diagnostic Data Viewer
120 Adjust master volume
121 Auto-launch app in multi-app kiosk mode
122 Enable/Disable Windows optional features
123 Disable toast/pop-up notifications
124 Reset Firefox
125 Log off users from current active sessions
126 Domain based sign in using GCPW
127 Set/Get event log properties
128 List all the connected Bluetooth devices
129 Create file share access
130 Verify File authenticity with Hashing
131 Automatic logon to screenless kiosks
132 Set up interactive logon messages
133 Perform network tasks
134 Start background job in PowerShell
135 Get current culture settings
136 Website kiosk
137 Python installation
138 Manage Remote Assistance
139 Fetch most recent error details
140 Export Start Layout
141 Connect to Microsoft Teams
142 Log off idle users
143 Install Microsoft Teams module
144 Deploy MSIX packages
145 Set lock screen background
146 System icons
147 List admin users
148 Update Bitdefender Endpoint Security Tools
149 Track app usage
150 Configure network share
151 Get Volume info
152 Connect to Wi-Fi network
153 Add Chrome managed bookmarks
154 Disable/enable user accounts
155 Manage services
156 DHCP configuration tasks
157 Delete inactive user profiles
  • Sample Script Repository