Well apparently I shouldn't script first thing Monday morning as I was passing the first [in] as null which it didn't like.
Bad code:
(Get-WmiObject -class "Win32_Directory" -filter "name='$systemroot\\System32\\LogFiles'" -ErrorVariable errorstatus -ErrorAction...
Having some trouble with the syntax for compressing a folder and all its subfolders/files. The Win32_Directory WMI class has the method CompressEx which has a recursive parameter which is supposed to then compress all subfolders/files under the initial folder.
If I call
(Get-WmiObject -class...
So I think this should be pretty easily but its something I constantly trip over.
In this specific example, I am trying to compress a folder. The following code works fine:
(Get-WmiObject -class "Win32_Directory" -filter "name='C:\\Windows\\System32\\LogFiles'").Compress()
However for...
Quick and dirty using an old script I had:
'Adds users to local groups on computers
'Constants for text file manipulation
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open and read the list of users
Set objUserFile...
You can also use WMI to do this. A quick sample to get you started:
strProcess = "ntbackup.exe"
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Kill backup process if it is running
Set colProcess =...
Not on the object itself. You would need to search through domain controller security logs in order to find the event that corresponds to the object modification that you are looking for. Quite a PITA as depending on how fast your security logs wrap, the event you're looking for may have been...
Thanks for the input guys. Someone in my dept. here at work happens to have the exact same model as the one provided in the CompUSA link and is going to let me borrow it :)
I have a stack of old hard drives at home from my PCs over the years. I always kept all the drives as I replaced them for obvious privacy issues plus I never knew if there would ever be anything on them that I may need in the future. I'd like to begin weeding them out so I can discard them...
Not sure about doing it with VBScript but you can easily do this by using desktop.ini.
For example, let's say you have a folder called C:\CustomFolder. In that folder you have C:\CustomFolder\desktop.ini. In the desktop.ini, you would have something like:
[.ShellClassInfo]...
Wow that worked like a champ right out of the box. I knew it was an issue with the array and I was trying something similar before I gave up Friday night. Beat my head into the wall for a while on that one. Thanks a lot tsuji!
Hey guys, been a long day. I'm having trouble wrapping my head around how to remove an ACE from a DACL if the Trustee matches a certain group. I'm opening a couple text files to read in a list of servers and a list of shares. Then I cycle through each targeted share on each server reading in...
Yeah I tried calling the SetInfo in the loop and it still did the same thing, wouldn't delete anything. The SetInfo works outside the loop for the CLEAR so I think it should for the DELETE also. I'm assuming I can go through the proxyAddresses array once and mark the ones I'm looking for as...
Hey all, I got what I think should be a relatively simple script.
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_DELETE = 4
strDN = InputBox("Enter the distinguishedName:","Clean up rfax: addresses")
Set objUser = GetObject("LDAP://" & strDN)
For Each strAddress In objUser.proxyAddresses...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.