Script GUI Add Domain

Hi,
I'm not very good programming, that's way I'm asking if anyone has a Script GUI in Powershell to Add a computer to a domain.
I've downloaded "PowerShell Studio 2014" to try do this, but I don't have a backround in programming.
My objective is to have a TextBox that capture the Serial Number of the computer (to be used as Computer Name).
A Dropdown or ComboBox listing differents OU.
A button to add domain
A buton to rename.
If possible on exit reboot the computer.
Cláudio Gonçalves

Hi Claudio,
making sure I get this right:
You wish to create a small form, that is used to rename a computer and join it to a domain, then restart the computer so the changes take effect. Maybe as part of a deployment scenario?
Note:
I'll skip the assigning OU part. If you have trouble with basic Forms this is not the place to mess with that.
Step 1: Designing what is really needed
Considering what your user has to be able to do, there is only one information he really has to provide (unless there are multiple domains to choose from). This information can be passed by placing a Textbox element on your form.
There is only one process without variation as you describe it, so we need a single button.
Step 2: Connecting GUI with code
When you select an element in the form designer, you'll see its properties on the right side. You can mostly ignore these for now, but there is one we need: In the category "Design" the property "name". Check out the name of the textbox you just placed,
we'll be needing it right away (by default PSS2014 will name the first textbox "textbox1", however feel free to rename it if you feel like doing so).
When you doubleclick on the button you placed, you menu will switch to code view, showing a code segement (a scriptblock) named "$button1_Click" (unless you changed the name of the button object in the designer). Everything you write down into that block
will be executed when your user clicks on the button of the form.
Step 3: Filling the logic
Now all that's left is to fill in the logic you need. You have all the form objects available as variables that are named just like the form objects were named (see step 2). If you kept the default names, the variable
$textbox1 contains your textbox. It has a property named "text", which just happens to be whatever is written in the textbox, thus you can get the user-input by reading this property ($textboy1.Text).
Now all you need to do is add a logic that does what you want:
Rename Computer
Join Domain
Reboot computer (Hint: Restart-Computer is a seriously cool command)
Cheers,
Fred
Ps.: I know not whether a form is the most efficient way to solve this, me not knowing your precise circumstances, but learning forms basics can't ever really hurt :)
There's no place like 127.0.0.1

Similar Messages

  • Remotely add Domain User to local group

    I've been playing with this for some time, and I seem to be missing something.  I am trying to develop a script that reads and XML file containing a list of computers, local groups, and names of domain users (and computers) to be added to the local
    groups.  I would like to be able to run this from a management workstation. 
    I've been working from these two posts.
    http://blogs.technet.com/b/heyscriptingguy/archive/2010/08/19/use-powershell-to-add-domain-users-to-a-local-group.aspx
    http://blogs.technet.com/b/heyscriptingguy/archive/2008/03/11/how-can-i-use-windows-powershell-to-add-a-domain-user-to-a-local-group.aspx
    It appears that the command $objGroup = [ADSI]("WinNT://atl-fs-001/Administrators") only works locally.  I have not been able to figure out any format that allows me to get the information remotely.  So I figured I would use Invoke-Command
    to execute the two lines of code remotely. 
    Invoke-Command -ComputerName RemoteServer {
    $de = [ADSI]"WinNT://RemoteServer/Administrators,Group"
    $de.psbase.invoke("Add",([ADSI]"WinNT://Domain/User").path)
    (I am trying it first with fixed, valid values - change to variables when I get things figured out.)  That gave me the error:
    Exception calling "Invoke" with "2" argument(s): "Number of parameters specified does not match the expected number."
    +CategoryInfo :NotSpecified: (:) [], MethodInvocationException
    +FullyQualifiedErrorID :DotNetMethodTargetInvocation
    +PSComputerName :RemoteServer
    I need help on what to try next.
    Thanks.
    . : | : . : | : . tim

    I've been playing with this for some time, and I seem to be missing something.  I am trying to develop a script that reads and XML file containing a list of computers, local groups, and names of domain users (and computers) to be added to the local
    groups.  I would like to be able to run this from a management workstation. 
    I've been working from these two posts.
    http://blogs.technet.com/b/heyscriptingguy/archive/2010/08/19/use-powershell-to-add-domain-users-to-a-local-group.aspx
    http://blogs.technet.com/b/heyscriptingguy/archive/2008/03/11/how-can-i-use-windows-powershell-to-add-a-domain-user-to-a-local-group.aspx
    It appears that the command $objGroup = [ADSI]("WinNT://atl-fs-001/Administrators") only works locally.  I have not been able to figure out any format that allows me to get the information remotely.  So I figured I would use Invoke-Command
    to execute the two lines of code remotely. 
    Invoke-Command -ComputerName RemoteServer {
    $de = [ADSI]"WinNT://RemoteServer/Administrators,Group"
    $de.psbase.invoke("Add",([ADSI]"WinNT://Domain/User").path)
    (I am trying it first with fixed, valid values - change to variables when I get things figured out.)  That gave me the error:
    Exception calling "Invoke" with "2" argument(s): "Number of parameters specified does not match the expected number."
    +CategoryInfo :NotSpecified: (:) [], MethodInvocationException
    +FullyQualifiedErrorID :DotNetMethodTargetInvocation
    +PSComputerName :RemoteServer
    I need help on what to try next.
    Thanks.
    . : | : . : | : . tim
    The ADSI commands work remotely as long as you are an administrator on the domain.
    Invoke-Command only works on systems set up for WinRM remoting and if you are an Administrator on the domain.
    Normally we would use AD and GP to add users to local groups.
    Your script is also incorrect.  Thisis the correct template.
    $remotepc='somepc'
    $de=[ADSI]"WinNT://$remotepc/Administrators,Group"
    $de.Add("WinNT://Domain/User")
    You should never the user to the admin group.  It is a formula for disaster.
    ¯\_(ツ)_/¯

  • Need script to add path and file name to fillable  form

    I have a fillable pdf form that I would like to have a script that adds the path and file name to the form. This script would be in a field at the end of the document.
    I am a newbie to javascript and formcalc. The script will be the only one in the form.
    Thanks for any assistance.
    Lisa

    Hi,
    I have a sample that attach a file to the PDF and write in a text field the file name. I don´t know how to get the full path and it only works in Acrobat. To work in Adobe Reader is necessary the LC Reader Extensions to give some special permissions to the document. But, regard this, you still want the sample send me a email to [email protected]
    Best Regards,

  • Simple bash script to add a '-' [Solved]

    I need to write a small bash script to add a '-' to each line in a file before displaying via conky!
    Todo
    - Get Milk
    - Buy Food
    - Pay Bills
    Currently I use
    TEXT
    Todo
    ${hr}
    ${head /home/mrgreen/.stuffigottado.txt 30 20}
    In .conkyrc but have to add '-' each time I edit .stuffigottado.txt
    Thanks in advance....

    Cerebral wrote:
    To filter out blank lines, you could just modify the awk command:
    ${exec awk '!/^$/ { print "-", $_ }' stuffigottado.txt}
    very nice; awk and grep: two commands that never cease to amaze me.

  • How to add domain computers in wsus

    how to add domain computers in wsus

    Refer this : http://technet.microsoft.com/en-us/library/dd939830%28v=ws.10%29.aspx
    Arnav Sharma | http://arnavsharma.net/ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

  • Add domain to email account name...

    Hey guys. We are running into a problem were we need to add @domain.com to all our users macmail settings.
    Instead is there an applescript we can run that only changes the username to simply add @domain.com?
    This would be a huge help! Thanks to any info you can provide.

    No Thunderbird does not support active sync...
    Now can you answer the question. So we can move on to a resolution. Is this an exchange server? If not what mail provider?

  • How to add domain account manager to executable?

    Hi All,
    LabVIEW 8.6.1 + DSC 8.6.1
    I have created local domain and some test users by using domain account manager. I also set user access levels to frontpanel indicators and controls. After that I build an .exe from my application.
    When I install  or move this application to other computer how I can also transfer my domain configuration to that second computer. It is assumed that these computers cannot be in same network..Can I someway add domain account manager to executable or should I install manager manually that second computer. I can't install whole labview that second computer...
    BR
    Solved!
    Go to Solution.

    You will be installing the LabVIEW runtime engine to work with the LabVIEW executable.
    Message Edited by Adnan Z on 03-13-2009 12:13 PM
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • Can not add domain name Error Protected word / inappropriate language

    Can not add domain name Error Protected word /  inappropriate language        
    Provide your Domain name :
    pragatiassociates.com
    Nature of Services provided: It located in India, Punjab. Its a new firm which will be focus on supplying products to Educational Institutes in and around Punjab 
    Problem: While trying to register domain on domains.live.com it gives error that  it contains a protected word or inappropriate language.
    The website is first phase version page has been hosted. Domain was purchased on 1-Mar-2014. Please help on priority as I need the mail solutions at the earliest.
    Posted query on  Microsoft answers no reply even after 4 days.
    http://answers.microsoft.com/en-us/outlook_com/forum/oadmincenter-ocustomdom/can-not-add-domain-name-error-protected-word/1322a218-3ad2-451c-a774-ae700465f9c4?tm=1394076201617

    Saurav S --
    Does your post have anything to do with Project Online, an enterprise project management application?  If so, please elaborate.  If not, please repost your question in a more relevant user forum.  Hope this helps.
    Dale A. Howard [MVP]

  • Script that adds objects every 2ft.

    Hi,
    So I need to make a script that adds an object every 2 feet around the perimeter of the page.
    I really just have no idea how to start. If anyone could point me in the right direction, or show me an example of something similar being done, that would be awesome!
    This is what I have so far:
    if (x2 >= 96 || y2 >= 96) { /* If x or y are longer than 8 Feet (96 inches) */   
        var x = x2/24;
        while (x > 36 && x < 24) { /* Objects need to be added every 2 to 3 feet */
            x /= 24;
        var y = y2/24;
        while (y > 36 && y < 24) { /* Objects need to be added every 2 to 3 feet */
            y /= 24;
    What I've been thinking (and what I have) is to get some fixed amount between 2 to 3 feet. Then I divide the total x or total y by that fixed amount, and that tells me how many objects I'll need to add.
    I feel like I'm heading on the right track, but making the elements seems to be the most challenging part. I have a function that makes the element I need, and the function is formatted like this: addCircle(page, top, left, bottom, right);
    Any help would be greatly appreciated! Thanks.
    EDIT:
    I have come up with a solution! (somewhat)
    So far it only does one side, but this works:
    var x = x2/24;
    while (x > 36 && x < 24) {
        x /= 24;
    x = Math.round(x);
    var stride = (x2/x);
    for (var i = 0; i <= x; i++) {
        if (i == 0) {
            addCircle (myPage, 0.25, stride*i + 0.25, 0.5, stride*i + 0.5);
        } else if (i == x) {
            addCircle (myPage, 0.25, stride*i - 0.25, 0.5, stride*i);
        } else {
            addCircle (myPage, 0.25, stride*i, 0.5, stride*i + 0.25);

    It seems you are on the right track, but I'm a really curious sort of person.
    How BIG are these 'pages' when you are going to have more than a single object on each side, spaced apart by 61cm!?

  • I created a script to add logos to photos at a club and now when I run the script, the script runs but does not actually place anything on the photo itself.  What's going on?

    I created a script to add logos to photos at a club and now when I run the script, the script runs but does not actually place anything on the photo itself.  What's going on?

    He meant post it here, of course, Louie!  How on Earth would you post it "on Photoshop" ? 
    Thank you for the belly laugh. 

  • Can not add Domain User to Local Admin Group Win8.1

    Hello, 
    I am trying to add a domain user to the local admin account on a Win8.1 Enterprise computer. When I click the check name button it asks me to enter network credentials even though I am signed in to the computer with a domain admin account. When I try to
    type in any of my domain admin accounts it says "The Username or Password is incorrect". Even though I used that same account to login with. I can successfully ping all 3 of my DCs from the computer and have tried putting my second DC as the primary
    DNS and my third DC as the primary DC and same problem. I have checked for Active Directory errors on the DC and everything says it is running fine on the DC in server manager. I have this problem on multiple computers. Some of the computers it will work on
    but 90% of them it won't allow me to add the local user to the local admin group. 
    DCs are running Win Server 2008 R2 Enterprise. 
    Any help would be greatly appreciated. 
    Thank You

    I would suggest you to use Restricted Group(via GPO) to add domain users/group to a local admins group 
    1)Create a new group in Active Driectory
    Create a new group in Active Driectory that you wish to add to every workstations local administrator group. DO NOT add any users to this group at this time.
    2.
    Create a new GPO
    Create a new group policy object and link it to the desired OU. Make sure that the GPO you are using covers the OU that the WORKSTATIONS you are wanting to give users local administrative rights over.
    3.
    Edit the newly created GPO
    Navigate within the newly created GPO to Computer Configuration -> Policies -> Windows Settings -> Security Settings --> Restricted Groups
    4.
    Add your new Active Directory group to the Restricted Group
    Right-click the Restricted Groups folder and select "Add Group" to add your new Active Directory group to the Restricted Group. In the Group field, type the name of the newly created Active Directory group and click "OK"
    5.
    Add the Restricted Group to the local administrator group
    In the Restricted Group Properties windows click "Add" under the section titled "This group is a member of:" Type "Administrators" (without the quotes and yes it is plural), in the Group Membership window and click "OK"
    6.
    Wait for GPO updates to apply to the workstations
    Once your users receive their updated group policy settings every workstation within the OU you specified will have your new Active Directory group as a member of the local administrators group. If you need to force the GPO update on a specific workstation,
    run "gpupdate /force" in a command window on that workstation.
    7.
    Add a user or group of users to the Active Directory Restricted Group
    When you are ready, or in a position where you need to provide local workstation admin rights you can simply add the users or group of users to the Active Directory group that you created for use with Restricted Groups within your Active Directory Management
    Console.

  • How to add domain users in RDP in Windows 2012R2

    I just setup Windows 2012 R2 standard server, need to setup domain users to access server via RDP.
    I have read many articles about it, and created a group policy, also add domain users group and individual domain user in Remote Desktop Users. Each user has local workstation administrator privileges.
    When log in to windows 7 pro, domain users still got error as the screenshot below. (administrator can RDP to server). Any one has an idea?

    On DC server:
    Run gpedit.msc
    Browse to Computer Configuration -> Windows settings -> Security Settings -> Local policies -> User Rights Assignment
    Edit "Allow log on through terminal services"
    Add domain users/groups
    Run gpupdate /force

  • SCCM 2012 - How to add domain id to local administrator group of all clients

    SCCM 2012 - How to add domain id to local administrator group of all clients
    Hi,
    i have a domain id sccmadmin which is a part of domain admins group too.
    Need to add this ID to the local administrators group of all clients. How do I do this? Please help!

    Hi ,
    you need to choose the second option .
    First option will remove all the domains users from the local administrator group available in all the PC'S .Then local administrator group will only have the users updated on the members list present in group policy.
    Note : Local admins accounts on the local administrators groups will not be removed.
    Second option will add the newly created group to the local administrator group in all the PC'S and it will not remove the existing members in the local administrators group.
    Step 1 : Just try to create one new group for SCCM management .
    Step 2 : Then add the SCCM account to that group.
    Step 3 : Then please create a new group policy on that just choose the second option.On that option just add the newly created group to be an member of administrator group in all the PC'S
    Why i have asked you to create a new group ?
    Because in second option , we don't have a option to add a individual user .
    Once you have created a group policy it will like below snap.
    As an additional i will tell how to find the newly created group policy is applying to computer objects or not ans also i will tell you how to force update the group policy 
    1.gpresult /r ----> To find the which group policy is applying on user and computer object .
    2.rsop.msc ----> There you can able to find the change has been applied or not .
    3.gpupdate /force -----> Forcefully updating the group policy in a client machine 
    4.In gpmc.msc there is one option called group policy results .That option will be used for centralized management to find the policies that are applied to a user and computer account.
    5.Just check the event viewer in all the PC'S for group policy related events.
    Most importantly you need to make sure all the computer accounts are placed in an ou ,where the newly created group policy is applying and also make sure that OU doesn't contain any inheritance block.
    Please feel free to reply me if you have any queries.
    Thanks & Regards S.Nithyanandham

  • Powershell script to add multiple domains to a transport rule

    I have a transport rule in Exchange 2013 that I created in the EAC (mail flow>rules).  it is set so *Apply this rule if.. the sender's domain is..  and then I entered a few domains.
    I want to use a powershell script to enter multiple domains into the senderdomainis parameter using the set-transportrule.  I would like to do this from a csv input file.  The file has  header row of domains and then the domains are listed
    under it.  This is also used successfully in a script that does content and sender id filter additions.
    I tried the following:
    $allowed = import-csv c:\temp\allowed.csv
    $Rule=get-transportrule "safe domain List"
    $Senderdomains =$rule.senderdomainis
    foreach($row in $allowed)
    $Senderdomains +=$row.domain
    #Set-Transportrule "Safe Domain List" -senderdomainis $Senderdomains
    It just adds a long line of all the domains mashed together without separation.
    Any ideas would be helpful.
    Thanks.

    This isn't the most elegant solution, but I was able to accomplish it with this script:
    $allowed = import-csv c:\temp\allowed.csv
    $domains=Get-TransportRule "Safe Domain List" | select -ExpandProperty senderdomainis
    foreach ($a in $allowed)
    $domains += $a.domain
    $domainstoadd = $domains | select -Unique
    Set-TransportRule "Safe Domain List" -SenderDomainIs $domainstoadd
    It's key to note that the column in the CSV file has a heading of "Domain". Basically the script pulls the existing array into a variable so you can add values from the CSV to the array. This creates duplicates,
    so the "Select -Unique" is a quick and easy way to eliminate the duplicates.

  • WLST Script to Add Users in Domain

    Hi,
    I am not able to find an example to add users in default realm in weblogic server using WLST. I navigated the MBean tree using WLST but didn't find a addUser function. I want to create an user in the realm and then add the user as part of a security policy for a JMS system module (All using WLST). I tried to record the actions in the console to a WLST script, but the record function doesn't record adding users to the realm. Any pointers to information is appreciated.
    Thanks,
    Chengi

    Thanks! That helped. I am now figuring out how to add the policy on the JMS module.
    Chengi
    Edited by: contrails on Jul 9, 2009 11:55 AM

Maybe you are looking for

  • Cannot open pdf files with Firefox's built-in pdf viewer

    This just started (I think) with Firefox 37.01. This is on Win7-X64. I cannot open pdf files with the Firefox built-in pdf viewer. If I click on the file or try to open it from within Firefox, it brings up a "opening filename.pdf" message. If I selec

  • PeopleSoft CS SAIP Announce Status Issue in Bulk Data Exchange Status

    XML is generated in the provided Directory Path under SAIP "Web Service Targets" but "Announce Status" is blank under Bulk Data Exchange Status, Even the "Event Message Monitor" shows nothing! We have activated all SAIP service operations and their d

  • Screen tearing at 1920*1080 resolution on samsung tv.

    Today I bought a display port to vga adapter so I could use my macbook pro in collaboration with my tv. I find that just moving the cursor or anything causes vsync like related screen tearing. Is there anyway I could stop this from happening? The spe

  • Text all bunched up - help please

    I have one text frame that bunches all my text up when I use 'justify with last line left'. It's fine everywhere else (about 150 pages). I've tried everything and am a bit stumped. I'd really appreciate any insight on this. Here's a screen shot (the

  • Sourcing 7.0 Standard Implementation Estimate

    Hello, We are looking to implement following standard features of SAP Souring 7.0 (on premise) for one of our customers: - Strategic Sourcing - CLM We will use Global Text Search without Optimizer and Contract Generation. Based on what I have read I