Join INGunOwners For Free
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18

Thread: Any powershell scripters in the house?

  1. #11
    Semi-Moderator
    Bigtanker's Avatar

    User Info Menu

    Found this on FB from some guy.


    You have to put the URL in as a variable and call it later.

    $uri = "https://directnic.com/dns/gateway/[the secret string they provide]/?data=$wanip"
    Invoke-WebRequest -uri $uri


    Need help posting Pictures? GO HERE for imgur
    >>>>>>>>>>
    https://www.ingunowners.com/forums/f...ing-video.html

    How to embed a YouTube video....
    https://www.ingunowners.com/forums/f...st7836731NGOer

    # 22951

  2. #12
    Grandmaster Cameramonkey's Avatar

    User Info Menu

    Quote Originally Posted by Bigtanker View Post
    Found this on FB from some guy.

    Dont listen to him. He's a loser. Quite handsome, but a loser.
    Quote Originally Posted by Kirk Freeman View Post
    A confused cop is an arresty cop.
    Quote Originally Posted by hoosierdoc View Post
    also, where do we sign up to touch Frank's equipment?

  3. #13
    Grandmaster Cameramonkey's Avatar

    User Info Menu

    Quote Originally Posted by jkaetz View Post
    A winning lotto number generator.

    I also just noticed my 2nd example has the closing paren inside the double quote, it should be outside. I'm somewhat surprised that didn't work though. I've run into more than a few instances where I had to force PS to evaluate a string before giving it to a cmdlet.
    I didnt even try the second example, because its the exact way that I tried and failed at. It apparently only parses the variables when the entire URI is sent up as a variable itself. (Mind boggling) Adding the variable to the end of the URI as a command causes it to push it to the web server exactly as written, and the variable name is not replaced with its value.

    Its times like this I am reminded why I do servers and networks, and not scripting/programming. Drives me absolutely nuts.
    Quote Originally Posted by Kirk Freeman View Post
    A confused cop is an arresty cop.
    Quote Originally Posted by hoosierdoc View Post
    also, where do we sign up to touch Frank's equipment?

  4. #14
    Master fullmetaljesus's Avatar

    User Info Menu

    By chance, the secret string they give you, does it have special characters? Perhaps a couple $'s?

    If so PS was probably reading everything after it has a variable and dropping it.

    You could figure it out by changing your actual command to
    Write-host
    And it would spit out what it was seeing.

    You say you prefer to stick to servers and stay out of scripting. When you learn to embrace PS your job will become crazy less tedious and faster.

    PS has come a looong way in the areas of usefulness and documentation.

    Currently I'm a Linux admin so I never admit my PS skills for fear of getting drafted by the win team.

  5. #15
    Grandmaster Cameramonkey's Avatar

    User Info Menu

    No, no special characters in the URI. its all numbers and letters. Very benign.
    Quote Originally Posted by Kirk Freeman View Post
    A confused cop is an arresty cop.
    Quote Originally Posted by hoosierdoc View Post
    also, where do we sign up to touch Frank's equipment?

  6. #16
    Grandmaster Cameramonkey's Avatar

    User Info Menu

    Quote Originally Posted by fullmetaljesus View Post
    By chance, the secret string they give you, does it have special characters? Perhaps a couple $'s?

    If so PS was probably reading everything after it has a variable and dropping it.

    You could figure it out by changing your actual command to
    Write-host
    And it would spit out what it was seeing.

    You say you prefer to stick to servers and stay out of scripting. When you learn to embrace PS your job will become crazy less tedious and faster.

    PS has come a looong way in the areas of usefulness and documentation.

    Currently I'm a Linux admin so I never admit my PS skills for fear of getting drafted by the win team.
    Yes. I already have scripts to stand up my branch office servers to do stuff like setting time zones, installing the necessary roles and features, installing software, etc. I can now do about 40 steps in 2 scripts.

    I didnt say I didnt script, just that I dont LIKE to script. Which reminds me I still need to figure out the programmatic deletion of old backup files (>30 days old) in about a dozen directories. Trouble is one of the directories the backup mechanism exists, (backups are stored in the same folder as the puller script) so just deleting everything older than x days would delete the backup software during the first run. And it doesnt like putting the backup files somewhere else. Already tried and failed.
    Quote Originally Posted by Kirk Freeman View Post
    A confused cop is an arresty cop.
    Quote Originally Posted by hoosierdoc View Post
    also, where do we sign up to touch Frank's equipment?

  7. #17
    Master fullmetaljesus's Avatar

    User Info Menu

    $files = get-childitem $targetfolder -file -exclude "whatever" -recurse

  8. #18
    Master happygunner's Avatar

    User Info Menu

    Quote Originally Posted by Cameramonkey View Post
    First option worked like a charm. Thanks!

    Apparently you have to store it to get it to honor the variable.

    Somebody give Jkaets max rep for me. Board sez I gotta spread it around.
    Done


Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •