Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

How to remove characters from output

Hi, I have a powershell script that gives the below output @{Days=88} Basically, I am comparing the difference in Lastbootuptime with Get-date for a bunch of computers and doing a new-timespan (I...

View Article


Reply To: How to remove characters from output

Just about any time you see that @{Days=88} format, it’s PowerShell’s string representation of an object which has a Days property, and usually it comes from the exact problem in your current code: $b...

View Article


Reply To: Delete user profiles except admin

You can do this a couple of different ways, depending on your personal preference. You can set up a nested loop, as you already mentioned, or you can dynamically build a regular expression to test...

View Article

Image may be NSFW.
Clik here to view.

Setting security rights on a group from other domain

Hey everyone, My first script! I’ve written my own script to obtain rights on a folder or file of a specific group, and give those exact same rights to a different group. My script: $directory =...

View Article

Reply To: Setting security rights on a group from other domain

From what I can see, you should be able to simply update your text file so instead of having “SG-PROD-Kit” for the TargetGroup, for example, it says “ProductionDomainName\SG-PROD-Kit”. Alternatively,...

View Article


Reply To: Format from a Variable

Just FYI, here is my final sample script, and works like a charm. Thanks again Don for the proper push. $strComputers = "Computer1", "Computer2" Foreach ($strcomputer in $strComputers) { If...

View Article

Reply To: set "FTP Authorization Rules" on virtualdirectory

Have you tried to stop the FTP site before running your commands? Maybe IIS has the config locked for writing.

View Article

Reply To: Remote Service commands – multiple services/servers?

So the Get-Service command lacks the property of the startmode so you have to resort to WMI to see that. However the stupid thing is that the Set-Service command does allow you to do this and will...

View Article


Image may be NSFW.
Clik here to view.

Reply To: Setting security rights on a group from other domain

Hello Dave and thank you for answering. I’ve actually already tried that. It still resulted in a fail because it tries to look for the group named: ProductionDomainName\SG-PROD-Kit in my office domain.

View Article


Reply To: Setting security rights on a group from other domain

Hmm, that’s not really how it works. When you pass a DOMAIN\Name format string to an AccessRule constructor, it should try to contact that domain to look up the name. What error message, if any, do...

View Article

Reply To: Setting security rights on a group from other domain

On my way home it hit me that I tried it with (example) Contoso\Groupname and not Contoso.local\Groupname. Maybe that is what I did wrong :D. If it doesn’t work, I’ll try what you asked me to do in...

View Article

Image may be NSFW.
Clik here to view.

Reply To: How to remove characters from output

Thanks Dave for explaining. It worked! I am new to powershell and this was my first post on the forum. This forum is like a tutor to me

View Article

Image may be NSFW.
Clik here to view.

Reply To: Setting security rights on a group from other domain

I would like to thank you for your help Dave! Changing the domainname to the full domainname (domainname.local) did the trick. You may not have actually said it, but you mentioning...

View Article


Remote Sql Server backups

I have a script which looks like the following:- $machine = $computerName $server = New-Object Microsoft.SqlServer.Management.Smo.Server(“$machine”) Write-Host “server = $($server)” $backup =...

View Article

Reply To: set "FTP Authorization Rules" on virtualdirectory

Thanks Vern for your input, but I solved it in a strange way: Experimenting with appcmd, I found the 2 commands to accomplish it: C:\windows\system32\inetsrv\appcmd.exe set config “ftp root/usera”...

View Article


Reply To: Remove-Item help

hi, Will this work in powershell 2.0?. Add this function to you script. It should capture the calls to write-verbose. I do not have access to anything running powershell 2.0, so I cannot test it:...

View Article

Reply To: Remove-Item help

Hi Tore, That works for intercepting explicit calls to the Write-Verbose cmdlet, but it would not catch verbose output from compiled cmdlets such as Remove-Item. That type of output goes through the...

View Article


Null valued expression

Using a combination of Search-ADAccount, Get-ADAccount and the directory class ADSISearcher object, I am trying to compile a list of properties into a PSObject. Some of the cmdlets do not yield...

View Article

Restart servers with check of services?

Hello I would like to ask for some help on getting a script together that will reboot a list of servers and have the script check to verify that a couple of services have started after the reboot. The...

View Article

DSC – WinRM HTTPS connection

I’ve been following Don’s DSC book, labbing up DSC and seeing what might work best in a production environment. My test scenario includes pulling via HTTPS, in a non-domain setting, and using OpenSSL...

View Article
Browsing all 13067 articles
Browse latest View live