Quantcast
Channel: /r/powershell – How to Code .NET
Browsing all 8793 articles
Browse latest View live

Need help understanding this script.

Hey, i got the following script for my homework in my school and dont understand it. Anything will help. : $colItems = (Get-ChildItem $strDirectory -recurse | Measure-Object -property length -sum)...

View Article


Script that shows how much money the WannaCry creators made so far

I was bored so I made a simple script that queries the WannaCry bitcoin transactions. By default it shows the transactions in dollar but you can specify any currency. https://pastebin.com/p9naPChH...

View Article


How can I disable SMB from CLI?

How can I disable SMB via CLI? I have attempted to use system(“powershell.exe Set-ItemProperty -Path “HKLM:SYSTEMCurrentControlSetServicesLanmanServerParameters” SMB1 -Type DWORD -Value 0 -Force”);...

View Article

Compare if statement not working as I expect in loop

I’m writing a script to log jobs in a job system based on information from our backup application. I’ve written smaller stuff before but this is my first decently sized script At a point in my script...

View Article

[PowerShell] Scan domain for WannaCrypt patch status [X-Post from...

I guess a lot of us have been working on checking if WannaCrypt is patched on our systems – this script will gather all Windows machines on a domain from AD and connect to each one to check the...

View Article


Easy way to search within help pages

Hello everyone, I’m looking for a way to search/skip around inside the get-help pages based on key words/letters the way I do in Linux man pages by using “/” to search. I know I can use the...

View Article

KevMar: GetPlastered, a Plaster template to create a Plaster template

submitted by /u/KevMar [link] [comments] The post KevMar: GetPlastered, a Plaster template to create a Plaster template appeared first on How to Code .NET.

View Article

Script to find unlinked GPOs

Heya, made this little thing to find my outdated GPOs. $NotLinkedString = Get-GPOReport -ReportType XML -All | Where-Object { $_ -notmatch "<LinksTo>" } FOREACH ($NLS in $NotLinkedString) {...

View Article


Help dot sourcing a script and then executing

Hi, sorry I’m still learning Powershell and looking into DSC. I’ve found the following lab but I’ve got stuck and need a bit of help – tried to google but no luck so far. Under Provision DSC Lab...

View Article


Output Looks Weird when sent via Send-MailMessage

Hey /r/powershell, i’m having an issue where I created a custom Function that generates an array with a dozen or so custom objects with 4 Properties. It’s outputting as as a table. For reasons I cant...

View Article

Function to return date x business days from present, accounting for holidays?

Writing a notification script that sends an email with a date 5 business days in the future (e.g. normally one week), but it needs to be able to account for holidays as well. Get-Date is working...

View Article

ACL – SetAccessRule | Taking into account Domain Controller Replication when...

All, have a script that creates new accounts, as well as creating a home directory share. However, recently I’ve found that replication is incredibly slow between certain DC’s. This is having an...

View Article

Invoke-command run as administrator

I’d like to do the following Invoke-Command computer -FilePath c:script.ps1 This isn’t working because script.ps1 requires to be run as an administrator. Does anyone know how to get around this?...

View Article


Getting a list of all emails sent by all users in CSV export from 365.

So I am tasked at work with finding out how export a list of all emails sent by all users within a given time period. They want the list to include a sent date, sent time, sender’s email address, the...

View Article

Compare list of computers against AD

I’ll admit I have no clue how to even start writing this script. I have a tool that uses AD to get a list of machines and then can deploy software to it. The tool has a reporting feature to tell you...

View Article


Performance analysis of my SMB1 detection script.

Hey Everyone, Like many of us, I’m taking steps to mitigate WannaCry, and I’ve written a SMB1 detection script for my servers. It runs, but it’s extremely slow, and I wonder if anyone can help me...

View Article

See printer manufacture or model?

Is there a way using get-printer that will show me the printer based on manufacture or model that does not rely on the driver as we have many printers using a generic driver? submitted by /u/aford89...

View Article


How can I catch this error?

I’m trying to include the ability to check if this script is running on a DC When I call Import-Module ActiveDirectory on a device that is not a DC, I get Import-Module : The specified module...

View Article

Calculated Property – adding to a date

I’m using PowerShell to connect to Office 365 to find out the last successful sync made by a mobile device to our Outlook system. The date and time are fine, but they are American time, as far as I...

View Article

Read-HostChoice – A simple way to let the host make decisions

Description I thought some of you might appreciate this cmdlet. I did write it to have a simple way for users to interact with my scripts. It lets the host choose an object from an array or from...

View Article
Browsing all 8793 articles
Browse latest View live


Latest Images