wever, mine thats included in the script should work fine.
$SiteList = @(
'dummy',
'New York 1234 Mcdonalds',
'London 2523 Mcdonalds'
)
$Computername = hostname
$Sitenumber = [int]$Computername.ToUpper().split('P').split('T')[1]
$SiteNamePosition = 380
$cSource = @'
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class Clicker
{
//[URL unfurl="true"]https://msdn.microsoft.com/en-us/library/windows/desktop/ms646270(v=vs.85).aspx[/URL]
[StructLayout(LayoutKind.Sequential)]
struct INPUT
{
public int type; // 0 = INPUT_MOUSE,
// 1 = INPUT_KEYBOARD
// 2 = INPUT_HARDWARE
public MOUSEINPUT mi;
}
//[URL unfurl="true"]https://msdn.microsoft.com/en-us/library/windows/desktop/ms646273(v=vs.85).aspx[/URL]
[StructLayout(LayoutKind.Sequential)]
struct MOUSEINPUT
{
public int dx ;
public int dy ;
public int mouseData ;
public int dwFlags;
public int time;
public IntPtr dwExtraInfo;
}
//This covers most use cases although complex mice may have additional buttons
//There are additional constants you can use for those cases, see the msdn page
const int MOUSEEVENTF_MOVED = 0x0001 ;
const int MOUSEEVENTF_LEFTDOWN = 0x0002 ;
const int MOUSEEVENTF_LEFTUP = 0x0004 ;
const int MOUSEEVENTF_RIGHTDOWN = 0x0008 ;
const int MOUSEEVENTF_RIGHTUP = 0x0010 ;
const int MOUSEEVENTF_MIDDLEDOWN = 0x0020 ;
const int MOUSEEVENTF_MIDDLEUP = 0x0040 ;
const int MOUSEEVENTF_WHEEL = 0x0080 ;
const int MOUSEEVENTF_XDOWN = 0x0100 ;
const int MOUSEEVENTF_XUP = 0x0200 ;
const int MOUSEEVENTF_ABSOLUTE = 0x8000 ;
const int screen_length = 0x10000 ;
//[URL unfurl="true"]https://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx[/URL]
[System.Runtime.InteropServices.DllImport("user32.dll")]
extern static uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
public static void LeftClickAtPoint(int x, int y)
{
//Move the mouse
INPUT[] input = new INPUT[3];
input[0].mi.dx = x*(65535/System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width);
input[0].mi.dy = y*(65535/System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
input[0].mi.dwFlags = MOUSEEVENTF_MOVED | MOUSEEVENTF_ABSOLUTE;
//Left mouse button down
input[1].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
//Left mouse button up
input[2].mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(3, input, Marshal.SizeOf(input[0]));
}
}
'@
Add-Type -TypeDefinition $cSource -ReferencedAssemblies System.Windows.Forms,System.Drawing
$wshell = New-Object -ComObject wscript.shell;
#Prepare workstation by turning off firewall,ipv6,setting ipv6,etc.
Set-ItemProperty –Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' –Name AutoAdminLogon -Value "1"
New-ItemProperty –Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' –Name DefaultUserName -Value "user"
New-ItemProperty –Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' –Name DefaultPassword -Value 'user'
Set-ItemProperty –Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' –Name DefaultUserName -Value "user"
Set-ItemProperty –Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' –Name DefaultPassword -Value 'user'
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private -Verbose
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0
Get-NetAdapterBinding | Where-Object ComponentID -EQ 'ms_tcpip6' | Disable-NetAdapterBinding -ComponentID 'ms_tcpip6'
Sleep 5
#Install CAL
$AnswerFile = @'
[{D2C63C6D-1FAC-4A7F-A994-F02F056CB853}-DlgOrder]
Count=0
'@
$AnswerFile > C:\bin\McrsCAL144\install.iss
C:\Bin\McrsCAL144\setup.exe /s /f1C:\bin\McrsCAL144\install.iss
#Wait for CAL
Sleep 27
#Click on dropdown
[Clicker]::LeftClickAtPoint(700,440)
sleep .6
#Select Multi Tenant Simphony
[Clicker]::LeftClickAtPoint(700,535)
sleep .6
#Click on OrgPA
[Clicker]::LeftClickAtPoint(600,535)
sleep .6
$wshell.SendKeys('') <----- ENTER YOUR INFO HERE
sleep .6
#Click on Server Name
[Clicker]::LeftClickAtPoint(600,500)
sleep .6
$wshell.SendKeys('') <----- ENTER YOUR INFO HERE
sleep .6
#Click on Update
[Clicker]::LeftClickAtPoint(700,500)
sleep .6
#Click on next
[Clicker]::LeftClickAtPoint(700,580)
sleep 3
#Click on Usernamebox
[Clicker]::LeftClickAtPoint(700,460)
$wshell.SendKeys('') <----- ENTER YOUR INFO HERE
sleep .6
#Click on Password
[Clicker]::LeftClickAtPoint(700,520)
$wshell.SendKeys('') <----- ENTER YOUR INFO HERE
sleep .6
#Click on Server
[Clicker]::LeftClickAtPoint(700,580)
$wshell.SendKeys('') <----- ENTER YOUR INFO HERE
sleep .6
#Click on Next
[Clicker]::LeftClickAtPoint(700,630)
sleep 3
#Click on site search box
$wshell.SendKeys($Site)
sleep .6
[Clicker]::LeftClickAtPoint(790,350)
sleep .6
#Click on site name
[Clicker]::LeftClickAtPoint(700,$SiteNamePosition)
sleep .6
#Click on next
[Clicker]::LeftClickAtPoint(730,780)
sleep 3
#Click on computer name search
[Clicker]::LeftClickAtPoint(600,725)
sleep .6
$wshell.SendKeys($Computername)
sleep .6
#click on Find button
[Clicker]::LeftClickAtPoint(770,725)
sleep .6
#Click on computer name
[Clicker]::LeftClickAtPoint(470,510)
sleep .6
#Click on Save
[Clicker]::LeftClickAtPoint(770,690)