Matt Bloomfield

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 377 total)
  • Author
    Posts
  • in reply to: Working with excel #274344
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    I stuck with two loops:

     

    in reply to: Working with excel #274062
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    Your problem is that you’re running two separate loops for each of your datasets and both of those loops are adding rows to your table.

    Your second loop either needs to be adding the data to row1, column2 or you need to use a single loop that populates row1: column1, column2; row2: column1, column2 etc.

     

    in reply to: Verifying Website Certificates #274029
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    Are these public facing websites or internal only?

    If they’re public facing, I think the best route will be to use the SSL Labs API

    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    No problem and don’t worry, you’re not overlooking anything; only moderators can lock the threads.

    in reply to: Getting the computer host name? #273001
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    <username> is a placeholder, you should replace it with the username of a user in your organisation.  I used it to demonstrate that you want to get the attributes of a single user, not all users (-filter *) as you were doing previously.

     

    Edit: to be clear, you should replace the whole thing, including the ‘<>‘ with the username.  As <> are redirection operators.

    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    If that is the case, I don’t think you can do this with New-WebServiceProxy because there’s no easy way to send custom headers.

    See: https://powershell.org/forums/topic/how-to-add-ws-security-element-to-soap-request-in-powershell/

    in reply to: Passing an input to a function #272926
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    What’s happening here is that $a and $b are actually String objects.  So the + operator is joining the string ‘5’ to the string ‘4’ and giving you ’45’.  You need to specify that the inputs are integers:

    Note: although I’ve done that in the function defintion, you could also specify the type elsewhere e.g.

    or even:

     

     

     

     

    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    In your Invoke-WebRequest example, you’re specifying a credential ($credential) but in your New-WebServiceProxy example you’re using -UseDefaultCredential which, by default, is the local user.  Does that local user have access to the service?  If not you will to specify an alternate account.

     

    in reply to: Blacklisting IP address via PowerShell automatically #272707
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    This seems reactive.  You’re waiting for a connection, then checking it against a DB and if it’s a known bad IP you’re blocking it.

    You should be blocking known bad IPs dynamically before they try to connect.  Most modern firewalls will update on a regular basis from the vendor but you can get MineMeld (just an example I’m familiar with) up and running pretty quickly to keep those blacklists up to date and block IPs before they attempt to connect.

    https://live.paloaltonetworks.com/t5/minemeld/ct-p/MineMeld

    in reply to: Getting the computer host name? #272701
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    The User object does not have have an attribute for the user’s computer.  There are methods for updating one of the other attributes to store this information using, for example, one of the ExtensionAttributes.

    If you know that your organisation stores this data in the User object, you’ll have to identify which attribute you’re using yourself.  The easiest way to do this is to find a user that you know has that attribute set then run:

    You can then identify from all the displayed properties which attribute(s) you’re using to store this data.

    in reply to: Clearing Clipboard #272686
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    As Mike suggests, PS version is key if you want to use Set-Clipboard as it was introduced in a later version (5.0?).  Although I would suggest using $null rather than an empty string or one with a space in it.

    If the cmdlet isn’t available, you should be able to pipe to clip.exe in PowerShell without any problem if the cmdlet is not available to you.  The example you gave isn’t working because in PowerShell echo is an alias for Write-Output.

     

    in reply to: Where-Object – Matching any integer in an array #271120
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    Are you sure the PS version on the other servers is the same?

    A quick check running powershell -version 2.0 confirms that the error is the same.  I can’t get it to return anything different.

     

     

    in reply to: Menu within a Menu #271108
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    If you add a Start-Sleep -Seconds 5 to either of your functions you’ll see that they’re being called.  They’re then exiting and then returning to the do-until loop.

    You need to run the loop until ($input -eq ‘q’ -or $input -eq ‘1’ -or $input -eq ‘2’)

    in reply to: Where-Object – Matching any integer in an array #271093
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    I agree with Mike that you should try and upgrade those servers.  The -in operator was introduced in version 3.0 so this is likely to be version related.

    in reply to: Where-Object – Matching any integer in an array #271024
    Participant
    Topics: 2
    Replies: 377
    Points: 496
    Helping Hand
    Rank: Contributor

    Do you think it’s best practice to put an array/variable like this within the script block itself, or does it not really matter if you just use $USING: ?

    I think either way is acceptable as long as your code is consistent.

    I’m aware of problems with $Using if you’re developing with Pester but in most (all?) other cases passing local variables with $Using should be fine.

Viewing 15 posts - 1 through 15 (of 377 total)