Weekly Tip 58

You can use this script to mass create sequentially named computer objects in AD. This is helpful if you pre-stage object before imaging, and they are all named with a common scheme. This script requires the AD PowerShell module. The first variable ($number) should be one less than the starting number, meaning that if your first machine is ABC-01, this variable should equal zero. Second, input your naming scheme on the line that starts with $name. Change the OU path on the new-adcomputer line to reflect the location where the objects should be created. Finally, change the “Until” line to be the last machine, meaning that if I want 1 – 25 created, I would make this line ABC-25.

Import-Module activedirectory

$number = 0

Do {
$number = $number + 1
If ($number -lt 10) {$name = “ABC-0” + “$number”} Else {$name = “ABC-” + “$number”}
new-adcomputer -name $name -SAMAccountName $name -path “ou=accounting,ou=computers,dc=contoso,dc=com”
write-host “created $name”
} Until ($name -eq “ABC-25”)



Contact Us

On Key

More Posts

WME Security Briefing 27 May 2024

Kinsing Hacker Group Exploits Docker Vulnerabilities Overview Recent investigations have shown that the hacker group Kinsing is actively exploiting Docker vulnerabilities to gain unauthorized access to systems. The modified hacker group targets misconfigured Docker API ports deployed with cryptocurrency mining malware.

Read More »
WME Cybersecurity Briefings No. 010
Cyber Security

WME Security Briefing 20 May 2024

Advanced Persistent Threats: North Korean Hackers Launch Golang Malware Overview A new malware strain, called Titan Stealer, is currently actively circulating in the threat landscape, targeting a variety of personal data and linked to North Korean state-sponsored cyber espionage

Read More »
WME Cybersecurity Briefings No. 009
Cyber Security

WME Security Briefing 08 May 2024

Exploitable vulnerability in Microsoft Internet Explorer, used to deploy VBA Malware Overview Cybersecurity researchers discovered a severe exploitation targeting a bug that had already been patched in the Microsoft Internet Explorer browser. Their report added that

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.