주제: powershell
-
Preparing a new disk in Windows Server: Get-Disk through Format-Volume, and why it starts offline
The PowerShell Storage module sequence from Get-Disk to a mounted, formatted volume — Initialize-Disk -PartitionStyle GPT, New-Partition -UseMaximumSize, Format-Volume, and resizing later with Get-PartitionSupportedSize — plus the SAN policy that leaves some newly attached disks offline by default.
-
Enabling and using PowerShell remoting: WinRM, TrustedHosts, and the second-hop limit
Turning on PowerShell remoting with Enable-PSRemoting, choosing between TrustedHosts and HTTPS transport, running commands with Invoke-Command and Enter-PSSession, and the credential-delegation limit known as the second hop.
-
Installing Windows Server roles and features from PowerShell without stacking pending reboots
Get-WindowsFeature and Install-WindowsFeature -IncludeManagementTools cover discovery and install, -Source points at Features-on-Demand media when the local component store lacks the files, and the returned object tells the caller whether a restart is still owed.
-
Managing Active Directory users and groups from PowerShell without scanning the whole directory
Get-ADUser with -Filter and -Properties, New-ADUser with a SecureString password, Add-ADGroupMember, and Search-ADAccount/Unlock-ADAccount for lockouts — plus why -Filter * is a trap in a directory with tens of thousands of objects.
-
Building resilient storage on a standalone server with Storage Spaces, and replacing a failed disk
New-StoragePool grouping physical disks, New-VirtualDisk with Mirror or Parity resiliency, watching health with Get-PhysicalDisk and Get-StorageJob, and the documented sequence for swapping a failed disk without losing the pool.
-
Administering DNS Server zones and records from PowerShell, then verifying with Resolve-DnsName
Get-DnsServerZone, adding A and CNAME records, listing records with Get-DnsServerResourceRecord, the scavenging/aging settings that expire stale records, and clearing the resolver cache — with every write checked from the client side, not just the server's own view.
-
IIS administration basics from PowerShell: sites, app pools, logs, and backing up the configuration
Reading sites with the IISAdministration module's Get-IISSite, recycling an application pool, where IIS writes its logs by default, and using appcmd add backup to snapshot applicationHost.config before a configuration change.
-
Line endings, encodings and paths: what breaks when a file moves between operating systems
CRLF versus LF, the inconsistent encoding defaults of Windows PowerShell 5.1 versus BOM-less UTF-8 in PowerShell 7, EBCDIC on IBM mainframe-family systems, and filesystems that disagree about case sensitivity and maximum path length: a checklist of what to verify before assuming a text file or a path behaves the same way on a different OS.
-
Hyper-V from PowerShell: virtual machines, checkpoints, and why a checkpoint is not a backup
Get-VM and the shape of a New-VM call, the difference between Standard and Production checkpoints, Export-VM for moving a VM, integration services, and the -ExposeVirtualizationExtensions switch that turns on nested virtualization.
-
Managing the DHCP Server role from PowerShell: scopes, reservations, authorization, and backup
Get-DhcpServerv4Scope and leases, reserving an address with Add-DhcpServerv4Reservation, authorizing a server in AD with Add-DhcpServerInDC, a failover overview, and backing up the configuration with Backup-DhcpServer before a risky change.
-
Privilege elevation compared: sudo, doas, UAC, runas and AIX RBAC — and how to detect it
sudo, doas, Windows UAC and macOS's admin group all answer the same question — is this session allowed to act as an administrator — with different mechanisms and different ways for a script to check the answer before attempting a privileged action.
-
Checking Active Directory health before making any change: dcdiag, repadmin, and the FSMO holders
A pre-change health routine for a domain controller — dcdiag for local diagnostics, repadmin /replsummary and /showrepl for replication, Get-ADDomainController and netdom query fsmo for the domain controller and role-holder inventory, and why the PDC emulator's time source matters.
-
Building a scheduled task with the ScheduledTasks module: action, trigger, principal, and result codes
New-ScheduledTaskAction, -Trigger and -Principal compose into a task registered with Register-ScheduledTask; running as NT AUTHORITY\SYSTEM needs no stored password, and Get-ScheduledTaskInfo plus the documented Task Scheduler result constants tell an agent whether the last run actually succeeded.
-
Managing certificates from PowerShell: the Cert: drive, PFX import/export, and binding one to IIS
Browsing Cert:\LocalMachine\My, filtering by expiry with Get-ChildItem, moving a certificate with its private key via Import-PfxCertificate/Export-PfxCertificate, New-SelfSignedCertificate for test use only, and binding the result in IIS with New-WebBinding or checking it with netsh http show sslcert.
-
Microsoft Defender Antivirus on Windows Server from PowerShell
Get-MpComputerStatus, Update-MpSignature, Start-MpScan and Get-MpPreference cover status, signature freshness, on-demand scanning and exclusion review from the command line; the least-exclusions principle applies because every exclusion is unscanned surface, and detections land in the Windows Defender event log and Get-MpThreatDetection.
-
Detecting the operating system from a script: uname, os-release, sw_vers, oslevel and a fallback order
A portable script needs a reliable way to branch on operating system and version before running an OS-specific command from any of the other articles in this series. This methodology gives a fallback order — from the most specific, most reliable source down to a last-resort guess — for POSIX shells and PowerShell.
-
Troubleshooting Group Policy application: gpresult, gpupdate, and the GroupPolicy module
Reading what policy actually applied to a computer or user with gpresult /h and Get-GPResultantSetOfPolicy, forcing reprocessing with gpupdate /force, and backing up a GPO with Backup-GPO before editing it.
-
Scoping Windows Defender Firewall rules with NetSecurity without locking out your own session
Get-NetFirewallProfile and New-NetFirewallRule manage Windows Defender Firewall from PowerShell; scoping a rule by -RemoteAddress and -Profile keeps a management port open only to the addresses and network types that need it, and testing from a second session avoids cutting off the one you're using.
-
Reading, granting, and backing up NTFS permissions with icacls and Get-Acl/Set-Acl
icacls reads and grants NTFS permissions and encodes inheritance as (OI)(CI) flags; icacls /save and /restore back up and reapply an entire ACL tree before a change, and Get-Acl/Set-Acl give the same information as PowerShell objects.
-
Querying Windows event logs with Get-WinEvent -FilterHashtable and XPath
Get-WinEvent -FilterHashtable and -FilterXPath let an agent pull only the matching records from a remote host instead of paging through Event Viewer, and the result can be exported as JSON; only a handful of service-failure and reboot event IDs are cited here because a primary source could be found for them.
기계 판독 가능: JSON