Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Manage Windows Systems Effectively Using CMD and PowerShell

Managing Windows systems involves a variety of tasks such as user management, file system management, network configuration, and system monitoring. In this article, we will explore how to effectively manage these aspects using Command Prompt (CMD) and PowerShell, providing practical examples and sample scripts.

User Management

Creating a New User

To create a new user in Windows, you can use the net user command in CMD.

Example:

net user JohnDoe Pa$$w0rd /add

This command creates a new user named JohnDoe with the password Pa$$w0rd.

Adding a User to a Group

To add a user to a group, use the net localgroup command.

Example:

net localgroup Administrators JohnDoe /add

This command adds the user JohnDoe to the Administrators group.

File System Management

Listing Files and Directories

To list files and directories, you can use the dir command in CMD.

Example:

dir C:\Users\JohnDoe\Documents

This command lists all files and directories in the specified path.

Changing File Permissions

To change file permissions, you can use the icacls command.

Example:

icacls C:\Users\JohnDoe\Documents\example.txt /grant JohnDoe:F

This command grants full control (F) to the user JohnDoe for the file example.txt.

Network Configuration

Displaying Network Configuration

To display network configuration details, use the ipconfig command.

Example:

ipconfig /all

This command displays all network configuration details for the system.

Configuring IP Address

To configure an IP address, you can use the netsh command.

Example:

netsh interface ip set address "Local Area Connection" static 192.168.1.100 255.255.255.0 192.168.1.1

This command sets a static IP address for the Local Area Connection.

System Monitoring

Checking System Uptime

To check system uptime, you can use the systeminfo command.

Example:

systeminfo | find "System Boot Time"

This command retrieves the system boot time, which can be used to calculate uptime.

Monitoring Processes

To monitor running processes, use the Get-Process cmdlet in PowerShell.

Example:

Get-Process

This command lists all running processes on the system.

Automating Tasks with PowerShell

Creating a Scheduled Task

To create a scheduled task, you can use the New-ScheduledTask cmdlet in PowerShell.

Example:

$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-NoProfile -WindowStyle Hidden -File C:\Scripts\Backup.ps1"
$trigger = New-ScheduledTaskTrigger -Daily -At 3AM
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "DailyBackup" -Description "Daily backup task"

This script creates a scheduled task named "DailyBackup" that runs a PowerShell script daily at 3 AM.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.