-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddToLocalMachine.ps1
More file actions
15 lines (12 loc) · 868 Bytes
/
Copy pathAddToLocalMachine.ps1
File metadata and controls
15 lines (12 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## This first part parses the computer. Our company uses a two letter prefix followed by the serial.
## You may have to modify it to fit your infastructure.
Set-ExecutionPolicy -ExecutionPolicy Bypass
$serial = gwmi win32_bios | Select –ExpandProperty SerialNumber
$name = 'MachinePrefix-' + $serial
$name
#$serial
#Create a scheduled task to add the machine to the collection after login.
ipmo ScheduledTasks
$action = New-ScheduledTaskAction -Execute '"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"' -Argument "http://sccm-server/PowerShellScriptService/PowerShellScriptService.asmx/RunScriptWithArgument?argument='$name'"
$trigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Add To SCCM Collection" -Description "Add Computer to Dynamic Provisioning Collection" -User "SYSTEM" -Force