kvprasoon

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 1,306 total)
  • Author
    Posts
  • in reply to: Read computername from csv and list last logged on user in csv #257186
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    Well, the only change you need here is to take the computernames form CSV file using Import-CSV cmdlet.
    A small example below
    Lets say the header for computer name is Name

    But this is gonna kill you with time when targeting huge number of nodes. You can try using Invoke-Command with -AsJob then Get-CimInstance inside the scriptblock of Invoke-Command
    #1

    #2

    • This reply was modified 17 hours, 27 minutes ago by kvprasoon. Reason: Post correction
    in reply to: Script, web data recovery. #256787
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    Well, you should be able to get some APIs from Nessus documentation. Once you have the API available then its a matter of using the URI with Invoke-RestMethod to download the file.

    https://community.tenable.com/s/article/Use-the-Nessus-API-to-Export-a-Scan

    When I did a google search, above link is what I got and has all the details required. Maybe you will have to spend some time as you never used PowerShell for such use case. I would suggest you to read help documentation of Invoke-RestMethod and the above link, then put up some code and see what is happening. we are here to help when you get stuck in the code.

    • This reply was modified 5 days, 16 hours ago by kvprasoon. Reason: correct post
    in reply to: Parsing date from CSV #256784
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    Once you have an object of [DateTime] type, then you can use AddDays() method to add days.

    in reply to: Extracting data from excel and updating variables #256781
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    Not really clear on the content you shared above. CSV is fine , but the other Subscription Category 1 and 2, What are those. Where and How in the code are you putting them ?

    Do you have any code which can be shared here ? IT should make anyone helpful to understand your issue clearly.

    in reply to: Projecting commands in pipeline #255965
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    you would wanna have a look at below PowerShell module developed by Jim from PowerShell team as well.

    https://www.powershellgallery.com/packages/Microsoft.PowerShell.KubeCtl/0.0.3

    PS: PowerShell 7 is a prereq for this

    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    Having profile script in a remote location effects performance and is error prone. Why would you want all admins to use same profile and what is in your profile script, if you can share it will be good for folks to understand the use case a lil bit more.

    in reply to: When is -gt 0 NOT -ne $null ? #255947
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    AFAIK both filter works differently here, Where-Objects takes the object once Get-ADUser executes per user where as the built-in Filter does it internally then give the output. What is the difference in output with both the approaches.

    in reply to: When is -gt 0 NOT -ne $null ? #255923
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    0 and $null are not same, can you give lil more detail on against what cmdlet output you ran these fiilters and the difference in output in both.

    in reply to: Next Iteration of DSC #255920
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    I haven’t used DSC much at work, but I can give a thumbs up for Ansible, coverage for Windows is increasing in Ansible.

    in reply to: Weird behavior when using psversiontable with ‘Get-GPO’ #255359
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    This behavior is because of the formatting subsystem. When multiple expression comes in a single pipeline, then the formatting for the first one will be applied and the remaining will not get the proper formatting. You can pipe the second expression to Out-Default.

    I think user config and computer config values are calculated during formatting. You can check it in the GPO modules folder which will probably have a formatting file in xml format. I had an old blog post regarding formatting. You can have a look at it.

    http://www.viapowershell.com/2016/06/hidden-formatting.html

    PS: this behavior is changed in PowerShell core for built-in cmdlets.

    • This reply was modified 1 week, 5 days ago by kvprasoon. Reason: post correction
    in reply to: $ sign in name not working in my script #255089
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    this is because $ is used to represent variable in PowerShell and in this case it tries to interpret $SCCMTempDBvariable which doesn’t exists and finally translates to null. Wrapping up the string in single quote will make PowerShell to treat it as literal string, but in this case the whole string is wrapped in double quotes, hence anything inside with $ will be treated as variable. You escape it using backtick which is the escape character in PowerShell.

    • This reply was modified 1 week, 6 days ago by kvprasoon.
    • This reply was modified 1 week, 6 days ago by kvprasoon. Reason: code formating
    • This reply was modified 1 week, 6 days ago by kvprasoon.
    • This reply was modified 1 week, 6 days ago by kvprasoon.
    • This reply was modified 1 week, 6 days ago by kvprasoon. Reason: code formating
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    What you would probably need is to use -Recurse switch parameter of Get-ChildItem cmdlet then use ForEach-Object cmdlet to iterate through each folder item coming through.
    If you have not used these options, I suggest you to read documentation using Get-Help ForEach-Object -Full cmdlet.

    in reply to: What happened inside the PowerShell ETS? #255083
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    In the above code, you are getting members of the type, which is pscustomobject. Name and Age are not members of this type, but properties of an instance of PSCustomObject type.
    you would do

    You can find the whole PowerShell source code at http://www.github.com/PowerShell/PowerShell which is now for v 7.x

    in reply to: Alert NEW IP Address, Send email #254846
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    looks like something related to your smtp server. Are you sure on smtp details, are they correct ?

    • This reply was modified 2 weeks, 1 day ago by kvprasoon. Reason: post correction
    in reply to: How to use escape sequence in powershell command #254771
    Senior Moderator
    Topics: 9
    Replies: 1309
    Points: 4,782
    Helping Hand
    Rank: Community Hero

    you can make your script accept base64 encoded string as password then convert it to plaintext where required. So you can pass base64 encoded string without any special characters.

Viewing 15 posts - 1 through 15 (of 1,306 total)