Help with powershell script

I have an powershell commando that pulls all my machines of xenapp 7.6 that are registered.
But i want my script to show me output when an machine is unregistered. Can any one help me out with the if and else statement.
This is for registered machines:
Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'Registered' }
Th is for Unregistered servers:
Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'UnRegistered' }
Output is like this:
MachineName                                                                                          
RegistrationState
XXX\wsgrswxa01                                                                                               
Registered
XXX\wsgrswxa02                                                                                               
Registered
XXX\wsgrswxa03                                                                                               
Registered
I tried a little bit with if and else statement. But i don't know how to do it.
(example):
if(?)
echo “OK status – All XenApp machines or OK”
exit 0 #Return OK status
else
echo “CRITICAL status – These Machines(xxxx,xxxx) are Unregistered”
exit 2 #returns critical status
Can anyone help me out?

Hi,
you do that by 1) saving the query for unregistered machines, 2) Checking whether there are any unregistered Machines from that variable and 3) Writing down the names (again from the variables).
Cheers,
Fred
oh, ok, here you go :)
$Machines = Get-BrokerMachine | Where { $_.RegistrationState -eq 'UnRegistered' }
if (($Machines | Measure-Object).Count -gt 0)
Write-Output "CRITICAL status – These Machines ($(($Machines | Select-Object -ExpandProperty MachineName) -join ",")) are Unregistered"
exit 2
else
Write-Output "OK status – All XenApp machines or OK"
exit 0
There's no place like 127.0.0.1

Similar Messages

  • Looking for help with PowerShell script to delete folders in a Document Library

    I'd like to create a PowerShell script to delete old folders in a Document library that are over 30 days old. Has anyone created something like this?
    Orange County District Attorney

    Hello Sid:
    I am trying to do the same and Iam running the script to delete the subfolders inside a folder  but I have some errors. 
    Could you please take a look?
    _______Script________
    $web = Get-SPWeb -Identity https://myportal.mydomain.com
    $list = $web.GetList("ar_mailingactivity")
    $query =  New-Object Microsoft.SharePoint.SPQuery 
    $camlQuery = '<Where><And><Eq><FieldRef Name="ContentType" /><Value Type="Computed">Folder</Value></Eq><Leq><FieldRef Name="Created" /><Value Type="DateTime"><Today OffsetDays="-30" /></Value></Leq></And></Where>'
    $query.Query = $camlQuery
    $items = $list.GetItems($query)
    for ($intIndex = $items.Count - 1; $intIndex -gt -1; $intIndex--)
       $items.Delete($intIndex);
    ________Errors_______
    Unable to index into an object of type System.Management.Automation.PSMethod.
    At C:\Script.ps1:2 char:22
    + $list =$webGetList <<<< "ar_mailingactivity"]
    + CategoryInfo
    :InvalidOperation: (ar_mailingactivity:String) [], RuntimeException
    + FullyQualifiedErrorID
    :CannotIndex
    You cannot call a method on  a null-valued expression.
    At c:\Script.ps1:6 char:24
    + $items = $list.GetItems <<<< ($query)
    + CategoryInfo
    :InvalidOperation: (GetItems:String) [], RuntimeException
    + FullyQualifiedErrorID
    :InvokeMethodOnNull

  • Help with Powershell script to gather eventlogs from all Domain Controllers

    I am trying to write a script to grab the last 5 days of application, security and system logs from all domain controllers. The script runs but only pulls the logs from the local server. The $Computer variable has all of my DC's so it is querying fine. I
    assume it is an issue with my ForEach-Object line but it doesn't error out. See the script below.
    $log = "Application"
    $date = get-date -format MM-dd-yyyy
    $now = get-date
    $subtractDays = New-Object System.TimeSpan 5,0,0,0,0
    $then = $Now.Subtract($subtractDays)
    $Computers = Get-ADDomainController -filter *
    ForEach-Object -InputObject $Computers  -Process {Get-EventLog -LogName $log -After $then -Before $now -EntryType Error | select EventID,MachineName,Message,Source,TimeGenerated | ConvertTo-html | Out-File $env:TEMP\Applicationlog.htm}
    Invoke-Expression $env:TEMP\Applicationlog.htm
    Thanks,
    Rich

    Also, you're missing the -ComputerName parameter in the Get-EventLog Cmdlet. 
    I would re-write the loop part of the script like this:
    $log = "Application"
    $date = get-date -format MM-dd-yyyy
    $now = get-date
    $subtractDays = New-Object System.TimeSpan 5,0,0,0,0
    $then = $Now.Subtract($subtractDays)
    $Computers = Get-ADDomainController -filter *
    foreach ($Computer in $computers) {
    Get-EventLog -ComputerName $Computer -LogName $log -After $then -Before $now -EntryType Error |
    select EventID,MachineName,Message,Source,TimeGenerated | ConvertTo-html | Out-File .\Applicationlog.htm -append
    Invoke-Expression .\Applicationlog.htm
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)

  • Please help me with Powershell Script - Message Box to display after Installation

    Hi Guys,
    Am using package model to deploy the software. After installation on client machines i want to display a dialog box to notify the successful installation.
    Currently trying VBScript to show the dialog message.
    But few machines i get this dialog and few machines am not getting, in program command line am calling a batch script.
    Now am planning to use a Power shell scripting to show a message box and trying to call it through a batch script.
    Please assist me with the powershell script which will display a message box like above
    (and let me know in script how to enable the set-execution policy Remote signed enabled)
    Thanks,

    You can set the execution settings from within the client settings.
    For a simple message box without having to load assmemblies
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup("Operation Completed",0,"Done",0x1)

  • Update a filed value with powershell script with ordery by and where condition

    Hi
    I have below powershell script to update list columns but  how i update a field value with ordery by a column and where condition
    below is the part of my script
    $list = $web.Lists[$listName]
    $items = $list.items
    $internal_counter = 1
    #Go through all items
    foreach($item in $items)
    if($item["CourtNO"] -eq $null)
    #if($item["CourtNo"] -eq '1')
    $item["CaseNo"] = $internal_counter
    #how to add a column ordery by Title
    # and where Title field value from 1 to 10
    $internal_counter++
    adil

    Hi,
    You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
    If so, use CAML query to get the items only match the condition.
    #Build Query
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
    Name="Title"/></OrderBy>'
    $spQuery.Query = $query
    $spQuery.RowLimit = $list.ItemCount
    $items = $list.GetItems($spQuery)
    Hope this help!
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Problems with PowerShell script

    Hi guys.
    Using this powershell scripts:
    http://gallery.technet.microsoft.com/office/Lync-Environment-Report-cbc6fb1a
    I have already a opened thread on MS TECHNET FORUM:
    http://social.technet.microsoft.com/Forums/office/en-US/a23ffdf8-fb10-4386-b21b-9f06cda84bdd/lync-environment-report-draw-pictures-in-visio?forum=lyncdeploy
    unable to solve the error for powershell script: New-LyncEnvDiagram.
    Is there any of you Power$hell Mai$ter$ able to understand why the script ain't working?
    with best regards,
    bostjanc

    Hi Bostjanc,
    Since we have no test enviroment, and this is difficult for us to debug the script.
    Maybe you can try to leave a comment to ask the author chris for helps:
    http://emptymessage.com/?p=149
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • Help with logon script

    Hi
    We have a legacy reporting app (Crystal Distribution 8.5) that relies on DLLs to export data from it to other apps such as Excel.
    In XP/2003 the DLLs are installed and accessed from the WINDOWS & System32 directory but due to changes that MS made in Vista/2008 and higher the DLLS need to be installed in the user's local profile for the app to work properly on Vista/2008+.  Example:
    C:\Users\user.name\WINDOWS\Crystal
    This has been easy to manage for the few users on Win 7 workstations but we are now making the move to Server 2008R2 RDS.  Therefore using a script to put these DLLs in the right place via Group Policy when a user logs on to an RDS server (there will be
    multiple and they will be load balanced) seems the logical answer.
    I am not however an expert on scripting by any means.  I can just about manage a logon script to map a network drive.  Could do with some help on:
    > A logon script that runs once per server per user that I can deploy with a GPO
    > The script needs to create a directory in their local user profile path (as previously mentioned) and copy a list of DLLs to it (or just copy the "Crystal" folder to the WINDOWS folder in their local profile).
    Many thanks

    Hi Flanjman,
    If the servers are deployed on server 2008 R2+, you can try a powershell script, and the script below may be helpful for you, which can create a new directory and copy the local folder to the new created folder:
    $newfolder = "C:\Users\user.name\WINDOWS\Crystal"
    New-Item -Path $newfolder -ItemType directory #create new folder
    copy-item -Path d:\test1 -Destination $newfolder -Force -Recurse #copy all the files in the folder
    Then please save the script above as .ps1 file, and follow this article to deploy in GPO:
    Start Me Up: Scripting a Logon with PowerShell
    Please also note, if the powershell execution policy on all the servers haven't been set to allow to run a powershell script locally, you also need delopy the execution policy in GPO firstly:
    Computer Configuration\ Administrative Templates\ Windows Components\ Windows Powershell" and configure the "Turn on script execution" setting, and choose "Allow local script and remote signed scripts"
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • How to copy a folder from TFS source control to Shared location with Powershell script

    Hi,
    I'm looking for a Powershell script where i could copy a folder from TFS Source control to a shared location.
    Details:
    $TeamProject/FolderA - here i want to move FolderA to a shared location called \\Share
    Tried with xcopy: xcopy "$TeamProject/FolderA" "\\Share" ( but no luck, later i found it's only possible to copy files from local to share or share to share location, not from server path to shared location.
    Can someone help me with the power-shell script to achieve above scenario.
    Thanks, BHSR

    Hope the below script works for your scenario. Got the code from http://stackoverflow.com/questions/23739499/copy-files-from-tfs-versioncontrol-to-directory-with-powershell
    $AutoDeployDir = "$\TeamProject/FolderA"
    $deployDirectory = "\\SERVER\SHAREFOLDER\"
    # Add TFS 2013 dlls so we can download some files
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.VersionControl.Client")
    $tfsCollectionUrl = "http://CDTFSSERVER:8080/tfs/ProjectCollection"
    $tfsCollection = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $tfsCollectionUrl
    $tfsVersionControl = $tfsCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
    # Register PowerShell commands
    Add-PSSnapin Microsoft.TeamFoundation.PowerShell
    # Get all directories and files in the AutoDeploy directory
    $items = Get-TfsChildItem $AutoDeployDir -Recurse -Server $tfsCollection
    # Download each item to a specific destination
    foreach ($item in $items) {
    # Serverpath of the item
    Write-Host "TFS item to download:" $($item.ServerItem) -ForegroundColor Blue
    $destinationPath = $item.ServerItem.Replace($AutoDeployDir, $deployDirectory)
    Write-Host "Download to" $([IO.Path]::GetFullPath($destinationPath)) -ForegroundColor Blue
    if ($item.ItemType -eq "Folder") {
    New-Item $([IO.Path]::GetFullPath($destinationPath)) -ItemType Directory -Force
    else {
    # Download the file (not folder) to destination directory
    $tfsVersionControl.DownloadFile($item.ServerItem, $([IO.Path]::GetFullPath($destinationPath)))
    Regards, Bharath
    LinkedIn:

  • I need help with this script please ASAP

    So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
    The script (Sorry if it's a bit long):
    #------------Startup-------------
    display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
    set Lolz to (button returned of the result)
    if Lolz is "Cyaaaa" then
    killapp()
    else if Lolz is "Take the Quiz" then
              do shell script "say -v samantha Ok starting in 3…2…1…GO!"
    #------------Question 1-----------
              display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
              set A1 to (button returned of the result)
              if A1 is "Apprentices" then
                        do shell script "say -v samantha Correct Answer"
              else
                        do shell script "say -v samantha Wrong Answer"
      #----------Question 2--------
                        display dialog "Most children were taught
    to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
                        set A2 to (button returned of the result)
                        if A2 is "Bible" then
                                  do shell script "say -v samantha Correct Answer"
                        else
                                  do shell script "say -v samantha Wrong Answer"
      #------------Question 3---------
                                  display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
                                  set A3 to (button returned of the result)
                                  if A3 is "Great Awakening" then
                                            do shell script "say -v samantha Correct Answer"
                                  else
                                            do shell script "say -v samantha Wrong Answer"
      #-----------Question 4--------
                                            display dialog "_______ was
    a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
                                            set A4 to (button returned of the result)
                                            if A4 is "Ben Franklin" then
                                                      do shell script "say -v samantha Correct Answer"
                                            else
                                                      do shell script "say -v samantha Wrong Answer"
      #----------Question 5-------
                                                      display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
                                                      set A5 to (button returned of the result)
                                                      if A5 is "Land" then
                                                                do shell script "say -v samantha Correct Answer"
                                                      else
                                                                do shell script "say -v samantha Wrong Answer"
      #---------Question 6--------
                                                                display dialog "The first step toward guaranteeing these rights came in 1215. That
    year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
                                                                set A6 to (button returned of the result)
                                                                if A6 is "Magna Carta" then
                                                                          do shell script "say -v samantha Correct Answer"
                                                                else
                                                                          do shell script "say -v samantha Wrong Answer"
      #----------Question 7--------
                                                                          display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
                                                                          set A7 to (button returned of the result)
                                                                          if A7 is "Parliament" then
                                                                                    do shell script "say -v samantha Correct Answer"
                                                                          else
                                                                                    do shell script "say -v samantha Wrong Answer"
      #--------Question 8-----
                                                                                    display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
                                                                                    set A8 to (button returned of the result)
                                                                                    if A8 is "King James II" then
                                                                                              do shell script "say -v samantha Correct Answer"
                                                                                    else
                                                                                              do shell script "say -v samantha Wrong Answer"
      #--------Question 9------
                                                                                              display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
                                                                                              set A9 to (button returned of the result)
                                                                                              if A9 is "William/Mary/Glorius Revolution" then
                                                                                                        do shell script "say -v samantha Correct Answer"
                                                                                              else
                                                                                                        do shell script "say -v samantha Wrong Answer"
      #---------Question 10-----
                                                                                                        display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
                                                                                                        set A10 to (button returned of the result)
                                                                                                        if A10 is "Rights" then
                                                                                                                  do shell script "say -v samantha Correct Answer"
                                                                                                        else
                                                                                                                  do shell script "say -v samantha Wrong Answer"
      #---------Question 11------
                                                                                                                  display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
                                                                                                                  set A11 to (button returned of the result)
                                                                                                                  if A11 is "Ohio" then
                                                                                                                            do shell script "say -v samantha Correct Answer"
                                                                                                                  else
                                                                                                                            do shell script "say -v samantha Wrong Answer"
      #------Question 12---------
                                                                                                                            display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
                                                                                                                            set A12 to (button returned of the result)
                                                                                                                            if A12 is "George Washington" then
                                                                                                                                      do shell script "say -v samantha Correct Answer"
                                                                                                                            else
                                                                                                                                      do shell script "say -v samantha Wrong Answer"
      #---------Question 13-------
                                                                                                                                      display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
                                                                                                                                      set A13 to (button returned of the result)
                                                                                                                                      if A13 is "Ben Franklin" then
                                                                                                                                                do shell script "say -v samantha Correct Answer"
                                                                                                                                      else
                                                                                                                                                do shell script "say -v samantha Wrong Answer"
      #--------Question 14------
                                                                                                                                                display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
                                                                                                                                                set A14 to (button returned of the result)
                                                                                                                                                if A14 is "" then
                                                                                                                                                          do shell script "say -v samantha Correct Answer"
                                                                                                                                                else
                                                                                                                                                          do shell script "say -v samantha Wrong Answer"
      #-------Question 15-------
                                                                                                                                                          display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
                                                                                                                                                          set A15 to (button returned of the result)
                                                                                                                                                          if A15 is "Command an attack against French" then
                                                                                                                                                                    do shell script "say -v samantha Correct Answer"
                                                                                                                                                          else
                                                                                                                                                                    do shell script "say -v samantha Wrong Answer"
      #------TheLolQuestion-----
                                                                                                                                                                    display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
                                                                                                                                                                    set LOOL to (button returned of the result)
                                                                                                                                                                    if LOOL is "Mr.White" then
                                                                                                                                                                              do shell script "say -v samantha Congratulations…you…have…common…sense"
                                                                                                                                                                    else
                                                                                                                                                                              do shell script "say -v alex Do…you…have…eyes?"
                                                                                                                                                                              #------END------
                                                                                                                                                                              display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
                                                                                                                                                                              set endmenu to (button returned of the result)
                                                                                                                                                                              if endmenu is "I did!" then
                                                                                                                                                                                        do shell script "say -v samantha Your awesome"
                                                                                                                                                                              else
                                                                                                                                                                                        do shell script "say -v alex Go outside and run a lap"
                                                                                                                                                                              end if
                                                                                                                                                                    end if
                                                                                                                                                          end if
                                                                                                                                                end if
                                                                                                                                      end if
                                                                                                                            end if
                                                                                                                  end if
                                                                                                        end if
                                                                                              end if
                                                                                    end if
                                                                          end if
                                                                end if
                                                      end if
                                            end if
                                  end if
                        end if
              end if
    end if

    Use code such as:
    display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
    set A1 to (button returned of the result)
    if A1 is "Apprentices" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    #----------Question 2--------
    display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
    set A2 to (button returned of the result)
    if A2 is "Bible" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    (90444)

  • Need help with a script applied by GPO

    Hello,
    I need to automate WebFeed insertion for Remote App Users at user logon.
    RDS 2012 R2 in place. Remote Apps are provided to W7 clients.
    Currently, WebFeed link must be inserted manually in each user's Control Panel\RemoteApp and Desktop Connections. There
    is no straight forward way from Microsoft.
    But there is a script and instruction I found on web...
    I followed the instruction... Created GPO. GPO applies to user but nothing happens.
    Can somebody check the script and the instruction that I could wrongly applied.
    In instruction there is no word about changing something in the script but only wcx file that the script should
    use.
    The script is below and here is my .wcx file:
    <?xml version="1.0? encoding="utf-8? standalone="yes"?>
    <workspace name="Enterprise Remote Access" xmlns="http://schemas.microsoft.com/ts/2008/09/tswcx" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <defaultFeed url="https://my_webserver_real_FQDN/rdweb/Feed/webfeed.aspx" />
    </workspace>
    I changed the quotes to vertical (") from (”) that
    were in my wcx when copied the lines from web.
    Still not works.
    I
    checked Application log, PowerShell and RemoteApp in eventviewer under user session
    Everything is clean.
    Were I can check the script execution log?
    When the user with applied script logs in, the icon of Remote
    connection appears for 10 seconds on the task bar and disappears.
    Looks like it's trying...
    Check please if the script really should not be touched and provide some troubleshooting
    steps.
    Thanks!
    INSTRUCTIONS from
    the link:
    http://www.concurrency.com/infrastru...rver-2012-rds/
    "Unfortunately
    Windows 7 clients are out of luck here. If you really want to use GPO to deploy
    RemoteApps to Windows 7 clients, then you have to jump through a few
    hoops.
    Create a new GPO and under User ConfigurationPoliciesWindows
    SettingsScripts, double click Logon and click the
    Show Files
    button. This will open an explorer window where you can copy files that will be
    saved within this GPO. Download the
    Install-RADCConnection.ps1 script from the TechNet gallery and
    save it there. Also create a new Text file named something like feed.wcx,
    open it in Notepad and paste in the following three lines of text:
    <?xml
    version=”1.0″ encoding=”utf-8″ standalone=”yes”?>
    <workspace
    name=”Enterprise Remote Access” xmlns=”http://schemas.microsoft.com/ts/2008/09/tswcx”xmlnss=”http://www.w3.org/2001/XMLSchema”>
    <defaultFeed
    url=”https://rds.domain.com/RDWeb/Feed/webfeed.aspx”
    />
    </workspace>
    Now select the PowerShell Scripts tab and
    click the Add button.
    Click Browse and select the .ps1 file and
    for the parameters enter the name of the wcx file. Click OK twice and you are
    ready to scope that policy to a set of users.   
    <#
    .SYNOPSIS
    Installs a connection in RemoteApp and Desktop Connections.
    .DESCRIPTION
    This script uses a RemoteApp and Desktop Connections bootstrap file(a .wcx file) to set up a connection in Windows 7 workstation. No user interaction is required.It sets up a connection only for the current user. Always run the script in the user's session.
    The necessary credentials must be available either as domain credentials or as cached credentials on the local machine. (You can use Cmdkey.exe to cache the credentials.)
    Error status information is saved in event log: (Applications and Services\Microsoft\Windows\RemoteApp and Desktop Connections).
    .Parameter WCXPath
    Specifies the path to the .wcx file
    .Example
    PS C:\> Install-RADCConnection.ps1 c:\test1\work_apps.wcx
    Installs the connection in RemoteApp and Desktop Connections using information
    in the specified .wcx file.
    #>
    Param(
    [parameter(Mandatory=$true,Position=0)]
    [string]
    $WCXPath
    function CheckForConnection
    Param (
    [parameter(Mandatory=$true,Position=0)]
    [string]
    $URL
    [string] $connectionKey = ""
    [bool] $found = $false
    foreach ($connectionKey in get-item 'HKCU:\Software\Microsoft\Workspaces\Feeds\*' 2> $null)
    if ( ($connectionKey | Get-ItemProperty -Name URL).URL -eq $URL)
    $found = $true
    break
    return $found
    # Process the bootstrap file
    [string] $wcxExpanded = [System.Environment]::ExpandEnvironmentVariables($WCXPath)
    [object[]] $wcxPathResults = @(Get-Item $wcxExpanded 2> $null)
    if ($wcxPathResults.Count -eq 0)
    Write-Host @"
    The .wcx file could not be found.
    exit(1)
    if ($wcxPathResults.Count -gt 1)
    Write-Host @"
    Please specify a single .wcx file.
    exit(1)
    [string] $wcxFile = $wcxPathResults[0].FullName
    [xml] $wcxXml = [string]::Join("", (Get-Content -LiteralPath $wcxFile))
    [string] $connectionUrl = $wcxXml.workspace.defaultFeed.url
    if (-not $connectionUrl)
    Write-Host @"
    The .wcx file is not valid.
    exit(1)
    if ((CheckForConnection $connectionUrl))
    Write-Host @"
    The connection in RemoteApp and Desktop Connections already exists.
    exit(1)
    Start-Process -FilePath rundll32.exe -ArgumentList 'tsworkspace,WorkspaceSilentSetup',$wcxFile -NoNewWindow -Wait
    # check for the Connection in the registry
    if ((CheckForConnection $connectionUrl))
    Write-Host @"
    Connection setup succeeded.
    else
    Write-Host @"
    Connection setup failed.
    Consult the event log for failure information:
    (Applications and Services\Microsoft\Windows\RemoteApp and Desktop Connections).
    exit(1)
    --- When you hit a wrong note its the next note that makes it good or bad. --- Miles Davis

    Use GPP for this. Do not use a script.  Post your issues in the GP forum.
    You should also visit the RDS forum to get information on how to distribute remote app links.
    ¯\_(ツ)_/¯

  • Split filename and create folders with Powershell script ( --newbie user)

    I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
    C:\workpics\1238955678.1
    C:\workpics\744556224.1
    C:\workpics\744556224.2
    C:\workpics\8445655996.1
    I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
    C:\workpics\12389\55678.1
    C:\workpics\7445\56224.1
    C:\workpics\7445\56224.2
    C:\workpics\84456\55996.1
    Any assistance to create this Powershell script would be awesome. Thank you!!

    I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
    C:\workpics\1238955678.1
    C:\workpics\744556224.1
    C:\workpics\744556224.2
    C:\workpics\8445655996.1
    I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
    C:\workpics\12389\55678.1
    C:\workpics\7445\56224.1
    C:\workpics\7445\56224.2
    C:\workpics\84456\55996.1
    Any assistance to create this Powershell script would be awesome. Thank you!!
    Please reread your request.  It makes no sense.  Read each statement carefully and notice that the statements are in conflict.
    Start your scrip in PowerShell.  Look up things like how to list files and how to manage strings.  All of the information you need is here:
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    ¯\_(ツ)_/¯

  • How to open IE browser in private mode with powershell script? $ie = New-Object -com internetexplorer.application

    How can I open IE, in inPrivate Browsing mode using PowerShell script?
    $ie = New-Object -com internetexplorer.application;
    $ie.visible = $true;
    $ie.navigate2("http://bing.com");
    while ($ie.Busy -eq $true) { Start-Sleep -Milliseconds 1000; }
    Ramana

    Hi
    Venkata,
    I’m writing to just check in to see if the suggestions were helpful. If you need further help,
    please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • Help with Apple Script Code

    Hi,
    I found this Apple script online and here's how it works:
    tell application "QuickTime Player"
    activate
    try
    if not (exists document 1) then display dialog "Please open a QuickTime movie." buttons {"Cancel"} default button 1 with icon 1
    set thefile to (choose file name)
    save document 1 in thefile
    close document 1
    end try
    end tell
    +I run the Apple script+
    *1. It prompts me to open a movie file in Quicktime*
    +I open a movie in Quicktime+
    *2. It prompts me for an name and directory to save the new file in*
    +I enter a name and directory+
    *3. It saves a new reference movie in said directory with said name*
    This is useful if I want to customize every file, but unfortunately, I just want to mass create reference movies for a whole bunch of files.
    What I am looking for is for an Apple script that is a drag and drop application, so I can drop say 100 movie files or so, and have the Apple script create reference movie files with the same name and in the same directory automatically with no prompts.
    Since I am unfamiliar with Apple script I was wondering if someone would be able to edit my existing script to do what I want.
    Thanks so much for your help!

    Use Automator. It's great for repetitious tasks (like the one you've described), and it's very user-friendly. Open Automator, create a new workflow that executes the action you want, and you can apply that action to the resources you wish to edit.
    Good resource here:
    http://bit.ly/

  • Help with simple script

    I was wondering if someone could help me with a simple bit of action script 3. I need to make a movie clip (single_mc) disappear when the user clicks on the mouse (stop_btn). Here’s what I have so far.
    function setProperty(event:MouseEvent):void
    single_mc.alpha=0;
    stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
    Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: I click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.
    Thanks for your time

    use the snippets panel to help with you with sample code for basic tasks.
    function setProperty(event:MouseEvent):void
    single_mc.visible=false;
    stop_btn.addEventListener(MouseEvent.CLICK, setProperty);

  • Help with sizing script

    I found a script online that turns my images into a square (by extending the canvas size of the short side to match the length of the long side) which is awesome, but I would like to do an additional step and I have no scripting experience so hopefully someone can help.
    now that my images are square I want to set a maximum dimension of 2500x2500 px, i have found scripts to set a resolution to a specific size but what I want to make sure I avoid is upsampling, so I just want any image larger than 2500x2500 px to down sample to 2500x2500 px
    any knowledge on the code for this would be much appreciated.
    When I am at the machine with the script I currently use I will paste it here in the meantime if you know something about scaling images down but preventing scaling them up I could probably chimp with the code I have and make it work.

    Photoshop shipts with a plug-in script that will do that for you. its found under menu File>Automate>Fit Image. Set both width and height to 2500 and check do not resize images that fit so your small square images will not be resized up in size.  You could also just create an action that uses both scripts
    step 1 menu File>Scripts>Make canvas Square.
    setp 2 menu File>Automate>Fit Image.  The 2500 x 2500 no upsize option settings will be recorded into the step and when the action is used its dialog will be bypassed and the recorded settings will ne used.
    You can then batch the action using menu file>Automate>Batch or menu File>Scripts>Image Processor.

Maybe you are looking for

  • I have Mac OS 10.5.8 but I'm told that I cannot update to Firefox 4 even though I'm told Firefox 3.5.6 is not secure.

    I am getting a message that my version of Firefox 3.5.6 is no longer secure against attacks, yet when I try to update to Firefox 4, I'm told that my Mac system isn't compatible even though I have system 10.5.8 and the requirement is supposed to be 10

  • Safari, can't following links

    I can load all the web pages I want, but when I select a link nothing happens. I can move the page, zoom in, zoom out, but now clicking on the link. If you put your finger on the link it is to show the address it links to, it doesn't even do that.

  • Collapsable Panel conflict?

    I am having an issue with a page containing a Spry horizontal menu bar ( which works fine) and a Spry Collapsable Panel (which does not). The page also contains a WOW jQuery Slider which is functioning correctly with the menu bar so I do not believe

  • OC4J and SonicMQ

    We are trying to integrate SonicMQ into our project instead of the OC4J JMS stuff. When we used Queues, everything appeared to work except that some messages weren't making their way back to Sonic. We couldn't trace what the problem was. So we switch

  • I cannot send or reply to emails

    I am having problems with my emails in that I now cannot send or reply, help?