Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all 15028 articles
Browse latest View live

Move items from Members to Members Of from a group

$
0
0

I have a bunch of groups where the names all start with the same text, ABC-123-, where I need to take everything that is a Member of the group, and remove it from there but add those items to the Member Of tab of that group.

Is there any way to automate this with a script?


Error with vbscript to download a file bypassing invalid certificate errors

$
0
0

Hi,

I'm trying to download a file from a PLC webserver that works great on my internal and external network but not when I try to download via a secure connection port 443 https.

I get the following error "THE HOST NAME IN THE CERTIFICATE IS INVALID OR DOES NOT MATCH"

I Have tried to find some info on the web but I’m getting a little lost. 

It seems that the secure https server is more likely to be an insecure https server... if you open the URL in your webbrowser you get the error  "untrusted connection" untill you install the certificate in the root certificate folder.

The Server is on a Siemens PLC, if I punch the full address with the secure port 443 into a browser, chrome or IE it downloads the file.

There is a certificate on the PLC that needs installing on the PC, do I need to add the info of this certificate into the script? full address is **CANNOT POST LINKS**!

if you just put in **CANNOT POST LINKS** you'll go to the PLC home page, the certificate is in the top RHS. I have downloaded and viewed the data. too long to post

There is only a PLC home page when I tell Firefox to ignore that failure it allows you to carry on so In fact, something with the certificate is wrong or it certificates another host name than your IP "The certificate is only vaild for 192.168.1.10????  The PLC IP address on the lan is 192.168.1.10. I don't think it is secure server, but it does use port 443. I can’t edit it for any other IP.

I have found a similar problem online but I'm not sure how to edit the code to see if it will help?!?

"server.address" may has invalid certificate or certificate from unknown issuer. You can ignore it and use the special option xmlhttp.setOption(2, xmlhttp.getOption(2) - 13056)

The code is not mine, I have edited it from an online example.  I was quite chuffed until I hit this problem :-/  any help appreciated.

Code below

CODE BELOW

search a string in registry and delete the property

$
0
0

Hello Scripting guy,

I was checking for the script  to search a string in registry value if it consists, then delete the value

Script that autokills Internet Explorer with a timer popup box

$
0
0
Looking for some sort of batch or vbscript that would autokill an open IE session, but first display a pop up message box with a timer of 60 seconds. This would be so the IE window doesn't close right away and gives the user time to notice the warning message. Thanks!

Get-EventLog "Microsoft-Windows-DNSServer/Audit" Error

$
0
0

Hello All, 

I am trying to get the logs from "Microsoft-Windows-DNSServer/Audit", but I am getting an error saying it does not exist even though withGet-WinEvents - List Log I am seeing the log exists.  What am I missing?

Thank you, 

David D.

Script "Always available offline" for subfolder of share on windows 7 x64 client

$
0
0

Hi,

I’m looking for a method to script (pref VBS) the simple client action of right clicking a folder, and selecting "always available offline". Any Ideas?

Scenario:

Deploying an application that has plugins and templates that we host in a subfolder of a share that contains templates and configurations for multiple applications, all in their own respective sub folders. When i deploy a specific app, i want the templates for that application available offline for laptops only, hence would be best as part of my deployment scripts.

This is easily accomplished when on a client by simply right clicking the subfolder, and selecting "Always available offline"

Common configurations im not after:

GPO "Administratively assigned offline files"
i don't want to configure multiple policies to cover multiple scenarios of applications and their offline availability. I also don't want to have all this filtering going on, per app, per machine type etc etc. Additionally i have tested this, can get it to work on a share ok, but not subfolders of that share. Although when i read the descrition of this policy setting it looks like it should do this, but my other reasons are more valid in our enterprise.

GPO to force offline files and "NET Share sharename /cache:documents" on server hosting the share
I cannot apply it to a subfolder, this function is only for shares as a whole. Again i would have GPO filtering mayhem as i don't want all system caching network files unnecessarily.

A share per managed app with these requirements
Yeah i though of that, but it's lame and an even bigger overhead than those above.

 

I'm open to other ideas also


Yarr

Using powershell to ping a list of computers from AD

$
0
0

I'm really new to PS, but I'm trying to learn!

I want to ping a list of computers, but I am running into a problem. Here is what I have so far.

$cmplist = Get-ADComputer -Filter { Name -like 'f7-fin*' }| select name

foreach ($cmp in $cmplist)
    {
       Test-Connection $cmp -count 1
    }

The first line works as I expect if I send $cmplist to echo, but when the test-connection kicks in it all falls apart. 

Test-Connection : Testing connection to computer '@{name=F7-FIN-SFA-6044}' failed:

I don't know why the name is getting to test-connection that way. What did I do wrong?

Ensure the 'Everyone' group does not have ChangeConf, WDac, or WOwn permissions

$
0
0

This is a nexus scan High Severity problem.  I not finding much on the internet.  I would like to do it in powershell if possible.

It is only on the Windows Update (wuauserv):DC,WD,WO

This output from nexus:

Plugin Text: Synopsis

: At least one improperly configured Windows service has a privilege escalation vulnerability.


Description

: At least one insecurely configured Windows service was detected on the remote host. Unprivileged users can modify the properties of

these affected services.

An unprivileged, local attacker could exploit this to execute arbitrary commands as SYSTEM.


Solution

: Ensure the 'Everyone' group does not have ChangeConf, WDac, or WOwn permissions. Refer to the Microsoft documentation for more

information.


See Also

: http://support.microsoft.com/kb/914392

http://msdn.microsoft.com/en-us/library/ms685981(VS.85).aspx


Risk Factor

: High


CVSS Base Score

: 7.2


CVSS Vector

: CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C


Plugin Output

:

The following service has insecure permissions for Everyone:

Windows Update (wuauserv) : DC, WD, WO


Plugin Publication Date

: 2010/02/22


Plugin Modification Date

: 2015/01/15


Plugin Type

: local


Source File

: smb_insecure_service_config.nbin


Loosing file extension

$
0
0


I scripting in Powershell 2.0


I'm using (symplified) code:

$xx = get-childitem -filter "testfile.txt"

$xx.copyto("c:\bak\testfile.txt")  - also tried MoveTo

I don't get any errors/exceptios

When I check the folder 'C:\BAK' I only find the file "testfile" w/o an extension.

I can't figure out what I'm doing wrong - any help would be greatly appreciated. 

script not running in the task manager.

$
0
0

Hi,

I have IIS log script which is not running in the task manager when i schedule a script to zip log files. please suggest.

Thank you.


This posting is provided "AS IS" with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing! http://sesaitech.blogspot.in/

Robocopy Output Editing

$
0
0

Im familiar with the switches available with robocopy, but I've seen something similar to what I have below done with the stdout of DiskPart. I need to cut a huge chunk of irrelevant but consistent info out of the output of each line during a robocopy. I don't have a machine in front of me right now, but I was wondering if anything similar has already been done or if anyone could point out something about robocopy that would make this logic useless as a means to edit the output. It's not perfect, but you should be able to tell where I'm headed with it.

Any advice is appreciated.

Thanks,

Kirby

:Header
ECHO This Header
ECHO ================
ECHO.
EXIT /B

SET /A ROBO_LINES=0

FOR /F %%a IN ('ROBOCOPY %SRC% %DST%') DO(
  IF ROBO_LINES==20 (
    SET /A ROBO_LINES=0
    CLS & CALL :Header
  )
  SET ROBO_LINES+=1
  ECHO %a:ThisString=%
)

Basically, cut out the junk string on each line out and clear the screen to make room when it prints about 20 lines. I've already used switches to cut robocopy's output down, but I need to remove a long string in the filenames that are the same through the whole process.

copy file into multiple folders

$
0
0
W2K3 AD Domain, XP Pro PCs.
 
I work as a teacher and frequently need to copy files (students assigned
work) into multiple folders (one for each student).
 
The students have an individual directory under each class they are a member
of.
 
Please could anyone let me know how to achieve this efficiently, perhaps
using a batch file to automate the process.
 
Thanks, Anastas
 
 

EXO Report on Internal Email Volume Per User

$
0
0

Hi Experts,

I need some help modifying an existing script which you can find here 

https://gallery.technet.microsoft.com/scriptcenter/Office-365-Mail-Traffic-afa37da1#content

This is a great script which shows the number of inbound and outbound for each recipient for all available trace data. 

Now what i need is to filter it so that only internal emails are included in the count. The discussion section of the script page shows the author of the script saying that it would be possible but much of the script would have to be re-written and he doesn't elaborate much on how it would be done.

Of course, this script might not be the right way to achieve the desired result. It just seemed close to what i needed so i will explain the requirements. The customer wants to see total numbers of emails between internal users (per user) for a 7 day period. They are implementing a chat program for internal communication to try reduce internal emails so they want to be able to see these numbers now and then run it again at 7 days intervals after the chat program is implemented to see whether it has reduced internal email volume. So you can see that it would be useful to see the results per user rather than total for everyone.

Thank you in advance for your assistance

Gabriel


Problem with writing to the remote application log on Windows 7 machine from Windows 10 computer

$
0
0

I attempt to write to the remote app log on Windows 7 computer. It worked well from Windows 7 machine, but after upgrading it to Windows 10, it no longer works failing with the error "The procedure number is out of range". 

eventcreate.exe /ID 1 /T INFORMATION /D "New Event" /S hostname

The same problem occurs when using a Write-EventLog cmdlet, CreateEventSource API, or LogEvent in VBS.

Thanks for any suggestions or workarounds.

Windows Service to call a VBScript

$
0
0
I have written two Windows Services that call asp pages.  Now I am needing a filesystemwatcher service to call a vbscript whenever somethingchanges in a specific folder.  The vbscript runs perfectly but I haven't been able to get the Windows Service to run the vbscript.  The code for my service is below.  Any suggestions would be greatly appreciated.

Imports System.IO

Public Class ConvertExcel

    Dim fsw As FileSystemWatcher

    Protected Overrides Sub OnStart(ByVal args() As String)
        ' Add code here to start your service. This method should set things
        ' in motion so your service can do its work.
        fsw = New FileSystemWatcher()

        fsw.Path = "C:\Windows\Excel"
        fsw.Filter = "*.xls"
        fsw.IncludeSubdirectories = False
        fsw.EnableRaisingEvents = True

        AddHandler fsw.Created, New FileSystemEventHandler(AddressOf file_created)

    End Sub

    Public Sub file_created(ByVal obj As Object, ByVal e As FileSystemEventArgs)
        Dim foo As New System.Diagnostics.Process
        foo.StartInfo.WorkingDirectory = "C:\BatchFiles\"
        foo.StartInfo.RedirectStandardOutput = True
        foo.StartInfo.FileName = "cmd.exe"
        foo.StartInfo.Arguments = "%comspec% /C cscript.exe //Nologo C:\BatchFiles\Upload_Converted_Excel_File.vbs"
        foo.StartInfo.UseShellExecute = False
        foo.StartInfo.CreateNoWindow = True
        foo.Start()
        foo.WaitForExit()
        foo.Dispose()
    End Sub
    Protected Overrides Sub OnStop()
        ' Add code here to perform any tear-down necessary to stop your service.
    End Sub

End Class

Formatting/extracing data of CustomObject

$
0
0
Hi,

I have this object in the following form

$Overview =
Time              : {29/03/2016 15:16:13, 9/12/2015 15:33:57, ...}
SoftwareName : Adobe - Reader
User     : {domain\user1, domain\user2, ...}


I'd like it to be
$Overview =
Time                SoftwareName      User
------               ------------     ------       
29/03/2016 15:16:13    Adobe - Reader domain\user1
9/12/2015 15:33:57    Adobe - Reader domain\user2  

The $Overview is
$overview | gm
   TypeName: System.Management.Automation.PSCustomObject

Please advise howto approach.
J.    

Jan Hoedt

Reset Windows Update Tool Problem

$
0
0
Running Vista SP2, 32-bit, 6.0.6002. The scripts is able to stop Windows Update, BITS and Crypto successfully, but I get "Open Services Failed 1060. Failed to stop the Application Identity Service" error msg. Then when I hit any key to continue, the cmd window closes. What am I doing wrong? Thanks.

Active Directory and Office 365 Onboarding / Offboarding automation script

$
0
0

Ok so I am hope that I find what I am looking for or at least pointed into the right direction.

I am looking to automate some of the onboarding/offboarding management of users accounts in Active Directory that are synced with Office 365 via Azure AD Connect. Knowing that most attributes are not synced this presents some challenges to my quest or my lack of knowledge with PowerShell. We have a high turn over right in my company (Point of Sale) and when we create a user account in Active Directory I need to have a script automatically provision the user in Office 365 with licensing for various components (e.g. Office 365 Pro Plus, Power BI, but not Yammer or Planner).

Now when I disable a user in Active Directory I need to have the user's mailbox converted to a Shared Mailbox and then based on the Manager attribute in ADSI grant that manager access to the disabled user's mailbox.

Any help will be greatly appreciated. 

Powershell Script for DHCP

$
0
0
I want to query DHCP configuration and I am not sure how to pipe all the results into one csv. I want to do a get-dhcpserverv4scope, binding, dnssettings, reservation, scope, scopestatistics and superscope. I would like to run one command and put the results into one file...

Add extension in FSRM File Group - Powershell

$
0
0

Hello Guys

i have a environemnt with Win2K8 and W2K12 environement where i have FSRM installed on all of the machine and we weekly update file ext on the file groups.

We are doing this manually so this is really a pain and feels like we are still living a world with out powershell.

I have used the FSRM Powershell module to develop script by which i am able to add file ext on all W2K12 server as Server 2012 has this module inbuilt but not working on W2K8 as thier PS does not recognise FSRM cmdlets.

I am using invoke-commnd to run it on remote server, please help me if there is any other way to run command on remote machine.

Here is script which i have developed

Function Add-FSRMFileGroupExt {

[cmdletbingind()]

param(

      [Parameter( 
        ValueFromPipeline=$true,
        ValueFromPipelineByPropertyName=$true)]
      [string[]]$ServerName,
      [string[]]$FileType
      )

begin {}

process {


Invoke-Command -ComputerName $ServerName -ScriptBlock `
{$Group=Get-FsrmFileGroup -Name "Temporary Files"
$Listext=$Group.IncludePattern + "*.Tempora","*.testtemp"
Set-FsrmFileGroup -Name "Temporary Files" -IncludePattern $Listext}

                                 }#Process Closing
                                 }#Function Closing
                              
                                 

Viewing all 15028 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>