335 words
2 minutes
Windows Server 2019 - Scripting and Sharing

Windows Server 2019 - Scripting and Sharing#

Wan Chai, Hong Kong

Windows PowerShell#

Microsoft Windows PowerShell can be accessed directly from the Windows Admin Center. Connect to your Windows Server via Admin Center and find PowerShell under Tools. Log in with your account.

Running PowerShell Commands#

Execute PowerShell commands directly from the web interface. For example, create a new user with New-LocalUser -Name Peter.

Windows Server 2019

Search for Local user & groups under tools in Admin Center and open user management in a new tab to see the created user.

Windows Server 2019

Working with the filesystem follows similar steps. Use commands like Get-ChildItem, New-Item, Copy-Item, and Remove-Item.

Terminal window
Get-ChildItem -Path C:\
New-Item -Path 'C:\scripts' -ItemType Directory
New-Item -Path 'C:\scripts\test' -ItemType Directory
New-Item -Path 'C:\scripts\test\helloworld.ps1' -ItemType File
Copy-Item -Path 'C:\scripts\test\helloworld.ps1' -Destination 'C:\scripts\hello.ps1'
Remove-Item -Path 'C:\scripts\test\helloworld.ps1'
Windows Server 2019

Run commands to view processes and services:

Terminal window
Get-Process
Get-Service

PowerShell Scripting#

Run local shell scripts through PowerShell. Store scripts with the .ps1 extension. Here’s an example script:

Terminal window
echo 'Hello World'
sleep 10

Save as helloworld.ps1, navigate to the directory, and run the script as .\helloworld.ps1.

Windows Server 2019Windows Server 2019

Creating a Samba Share#

Enable Remote Desktop on the server. Add a Desktop on your host machine in Remote Desktop. Connect to the remote server using the server name or IP address.

Windows Server 2019

Right-click the directory to share, choose Properties, Sharing, Advanced Sharing. Name the share and set Permissions.

Windows Server 2019Windows Server 2019

Discover the share from your host machine and connect using specified user login.

Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019Windows Server 2019
Windows Server 2019 - Scripting and Sharing
https://mranv.pages.dev/posts/windows-server-2019-scripting-and-sharing/
Author
Anubhav Gain
Published at
2024-04-13
License
CC BY-NC-SA 4.0