Anonymous Anonymous - 1 month ago
209 0

No description

PowerShell

Powershell

# YOURUSERNAME
# TITLE
# DATE
# Bullshit About what the script does goes here.

# Set up variables
    $abcd1234_usr = Read-Host "Enter user name."
    $abcd1234_grp = Read-Host "Enter group"
    $HOMEDIRECTORY = "C:\" + $abcd1234_usr
    $ANEWSHARE = "$abcd1234_usr" + "_share"

# Create user account
    $USERPASSWORD = Read-Host "Enter a password." -AsSecureString
    New-LocalUser $abcd1234_usr -Password $USERPASSWORD | Out-Null
    Write-Host "Account $abcd1234_usr created."

# Create group
    New-LocalGroup $abcd1234_grp | Out-Null
	Write-Host "Group $abcd1234_grp created."

# Add user to group
    Add-LocalGroupMember -Group $abcd1234_grp -Member $abcd1234_usr -ErrorAction SilentlyContinue
    Write-Host "User $abcd1234_usr added to group $abcd1234_grp"

# Create home folder
    New-Item -ItemType directory -Path $HOMEDIRECTORY | Out-Null
    Write-Host "Home folder $HOMEDIRECTORY created."
	
# Create network share
    New-SmbShare -Name "$ANEWSHARE" -Path "$HOMEDIRECTORY" 2>&1 >$null | Out-Null
    Write-Host "Network share $ANEWSHARE created."

# Exit statement
    Write-Host "Exiting."
    exit
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download