Thank you for looking at my first question on this website.
The purpose of this PowerShell script is to query the user for partial name of a pre-existing computer on the domain. After the query is completed, the full computer name receives a specific OU from the specific directory in the Active Directory, and it copies the entire computer's name to the user's clipboard. This is to help save time for those with whom I work in the help desk (including myself) who have to do this verbally manually every day.
Note: I'm pretty sure that there is no problem with two 'go-adcomputer' lines, because if I enter the full computer name manually in the script, then it works at all This issue either looks like how I am defining user input or how it is being passed along with variable ($ PCName) inside the 'Get-ADComputer' cmdlet.
The script here is in its entirety, the only thing I have left is a specific active directory - I know that it is looking at the right direction, because the lines taken personally and manually Names have been entered.
$ Global: PCName = (Read- Host "Enter Partial PC Name") Write-Host "You've entered a partial PC name: $ PCName" Returns $ PCName #PCName Table of Information Display . Get-ADComputer- SearchBase 'OU = (clutter)' -filter 'name-like' * $ PCName * "'-Properties IPv4Address | Format-Table Name, DNSHostName, IPv4Address -A # Progress Indicator Advisor Message. Write-Output" $ Converting a PCname to a full computer name and copying the result to your clipboard. "#clip line - retrieves the entire PC name and copies the compressed PC's name to the clipboard. Get-ADComputer- SearchBase 'OU = (dislocation) '-filter' name-like '* $ PCName *' '| Name -Ex Type Pump name: $ PCName - Solved and copied to clipboard. "
If there is any other mistake, then I appreciate it. I've been using PowerShell for less than a week and I'm a new programmer. I've demonstrated fewer than 40 Google queries and have spent at least 3 hours so that it can work Could try
New!!
No comments:
Post a Comment