techitaway

u/techitaway


r/PowerShell•

Hey everyone,

I'm having an issue with my code here and I've got an interesting problem with it.

https://pastebin.com/j0DGGR9p

When I run the code as is I get errors such as: Get-ADUser : Error parsing query: '{(scriptpath -eq "uname.bat") -and (DistinguishedName -notlike "UX")}' Error Message: 'syntax error' at position: '1'. At C:\Users\uname\Rx\Set-DriveMappingGroupByScriptMapping.ps1:8 char:5

  • Get-ADUser -Filter $filter
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ParserError: (:) [Get-ADUser], ADFilterParsingException
    • FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADFilterParsingException,Microsoft.ActiveDirectory.Man
32

r/nagios•

The title pretty much says it. If you were to start a fresh setup, which monitoring agent would you stick with and why? I'm looking to implement Nagios this year and there are so many to choose from. I'd like to standardize on one for simplicity's sake, but maybe that's a bad idea? We're mostly a windows shop but with a few mission critical AIX machines and a few flavors of Linux here and there. Would love to hear your experiences and how you'd do it today!

219

r/PowerShell•

I've got a pretty simple script that I'm using to make some DNS changes across swaths of pc's on our network. I had decided to add some functionality by adding the -ListOnly switch so that I can get a reading on what DNS servers a group of computers is set to use. When I run the script with that switch, the output lists the computer names and THEN lists all the output from get-wmiobject. Why am I not getting the output of each get-wmiobject separated by the computername?

Here is my script: http://pastebin.com/FAZ5atns

I'm also happy to hear any other comments/criticisms on this as well as I'm still pretty new to powershell.

Edit: Solved since apparently it works as it should?

92

r/Sysinternals•

I'm trying to put together a small script to start procmon alongside another program and I'm having some trouble getting procmon to behave. I'm not sure if this a bug or if I'm just doing something wrong. I have the following script:

for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
set datetime=%datetime:~0,8%-%datetime:~8,6%
    start "" "\\netstorage\software\microsoft\SysinternalsSuite\procmon.exe" /accepteula /backingfile \\netstorage\logdump\%computername%-%username%-%datetime%.pml /quiet /minimized /nofilter

echo "start program"
timeout /t 60 /nobreak
\\netstorage\software\microsoft\SysinternalsSuite\procmon.exe 
51

r/PowerShell•

Hey everyone, I'm new to powershell and have started to try and make my life by scripting a few of my more time consuming tasks at work.

I've created a script to delete and recreate some folders but I'm running into a situation with a few folders' permissions.

for example there is a folder with an owner $user. With a domain admin account I in explorer can change the owner, give domain admins full control, and then delete the folder. Let's not worry about subfolders and files for now.

In powershell I use start job to authenticate as a domain admin and try to change ownership:

$account = New-Object System.Security.Principal.NTAccount("domainnt", "Domain Admins")
$acl = Get-Acl -P
25


r/computertechs•

I'm looking into options for a client to try and find a good file sharing solution. They communicate and send files via email, both internally and externally. Outlook integration to easily turn files they would normally attach into a link would be the ideal solution that I can think of. Anyone run into software that works like this? I'd hate to add more steps into their process.

21

You've reached the end of this feed.