Search found 8 matches

by MikeFRobbins
Thu Jan 12, 2017 2:26 pm
Forum: Windows PowerShell
Topic: Scheduled Tasks Audit
Replies: 5
Views: 1473

Re: Scheduled Tasks Audit

If you happen to be working on a system with an older version of PowerShell that doesn't include the ScheduledTasks module, you can use schtasks.exe in PowerShell and produce object based output with it. schtasks.exe /Query /FO CSV /V | ConvertFrom-Csv | Select-Object -Property @{label='ComputerName...
by MikeFRobbins
Thu Jan 12, 2017 2:08 pm
Forum: Windows PowerShell
Topic: Log PS output to a file?
Replies: 13
Views: 15503

Re: Log PS output to a file?

You will have to list all of the files and delete the oldest one each time you want to make a new log. Correct. If the desire is to output a log file each time the script runs, I would recommend incorporating both of my previously posted commands into the script itself so it all happens automatical...
by MikeFRobbins
Thu Jan 12, 2017 1:21 pm
Forum: Windows PowerShell
Topic: Log PS output to a file?
Replies: 13
Views: 15503

Re: Log PS output to a file?

Hi, Please advise how I can log output of my existing scripts to a file then overwriting each first logfile file after 10 logfiles, hopefully without to much modifations to the script. S. Without knowing the details, you can simply pipe the output of your script to the Out-File cmdlet as long as th...
by MikeFRobbins
Mon Sep 19, 2016 2:11 pm
Forum: Windows PowerShell
Topic: psobject results not as expected
Replies: 11
Views: 2036

Re: psobject results not as expected

Where-Object in the first line of adding members in your script doesn't do anything. Changing it to ForEach-Object at least narrows it down to only the drive letter property: $obj | Add-Member -membertype NoteProperty -Name DriveLetter -Value (($LogicalDisks | ForEach-Object { $_.DriveLetter } ) | o...
by MikeFRobbins
Thu Mar 03, 2016 9:42 am
Forum: Windows PowerShell
Topic: Adding Multiple Users to Multiple AD Groups
Replies: 9
Views: 13580

Re: Adding Multiple Users to Multiple AD Groups

Looks like you were using the previous code I posted and it appears that you're running it on a machine with PowerShell version 2. I typically write all of my code to be compatible with PowerShell version 3 or higher. Here's a version that should work with PowerShell version 2.0: Import-Module -Name...
by MikeFRobbins
Wed Feb 24, 2016 3:22 pm
Forum: Windows PowerShell
Topic: Why do some of my parameters do not appear?
Replies: 17
Views: 4951

Re: Why do some of my parameters do not appear?

You do realize that you have two functions with the same name (Move-ADUserOU), correct? The parameters and help show up when I only use the one at the top, but the one at the bottom overrides the first one and does not contain the parameters or help that you're looking for.
by MikeFRobbins
Wed Feb 24, 2016 8:36 am
Forum: Windows PowerShell
Topic: TextBox input always in UPPERCASE
Replies: 5
Views: 4263

Re: TextBox input always in UPPERCASE

One thing to be aware of is that using conversions like .ToUpper() to do case insensitive comparisons can be problematic. Depending on the situation and what you're using it for, you may want to make sure your code passes the Turkey Test . I wrote a blog article about this problem if you're interest...
by MikeFRobbins
Thu Feb 18, 2016 3:23 pm
Forum: Windows PowerShell
Topic: Adding Multiple Users to Multiple AD Groups
Replies: 9
Views: 13580

Re: Adding Multiple Users to Multiple AD Groups

Consider making the additions based on group instead of user since Add-ADGroupMember allows multiple users to be added to a single group at the same time. $Header = ((Get-Content -Path C:\tmp\test.csv -TotalCount 1) -split ',').Trim() $Users = Import-Csv C:\tmp\test.csv foreach ($Group in $Header[1....